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 = '