From db4a06d97f4899f807581eee239195c54ca6f60d Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Fri, 5 Jul 2019 13:12:24 -0700 Subject: [PATCH] standard --- server.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/server.js b/server.js index 10eb839..f0db1f0 100644 --- a/server.js +++ b/server.js @@ -15,6 +15,8 @@ const parseHttpRequest = require('./lib/server/parse-http') const parseUdpRequest = require('./lib/server/parse-udp') const parseWebSocketRequest = require('./lib/server/parse-websocket') +const hasOwnProperty = Object.prototype.hasOwnProperty + /** * BitTorrent tracker server. * @@ -147,7 +149,7 @@ class Server extends EventEmitter { let key for (key in allPeers) { - if (allPeers.hasOwnProperty(key) && filterFunction(allPeers[key])) { + if (hasOwnProperty.call(allPeers, key) && filterFunction(allPeers[key])) { count++ } } @@ -158,7 +160,7 @@ class Server extends EventEmitter { function groupByClient () { const clients = {} for (const key in allPeers) { - if (allPeers.hasOwnProperty(key)) { + if (hasOwnProperty.call(allPeers, key)) { const peer = allPeers[key] if (!clients[peer.client.client]) { @@ -179,10 +181,10 @@ class Server extends EventEmitter { function printClients (clients) { let html = '