use native Set instead of uniq library

This commit is contained in:
KayleePop 2020-03-14 15:52:06 -05:00 committed by Kaylee
parent 7ec91ebecc
commit 0c459aff78
2 changed files with 2 additions and 3 deletions

View File

@ -3,7 +3,6 @@ const EventEmitter = require('events')
const once = require('once') const once = require('once')
const parallel = require('run-parallel') const parallel = require('run-parallel')
const Peer = require('simple-peer') const Peer = require('simple-peer')
const uniq = require('uniq')
const common = require('./lib/common') const common = require('./lib/common')
const HTTPTracker = require('./lib/client/http-tracker') // empty object in browser const HTTPTracker = require('./lib/client/http-tracker') // empty object in browser
@ -71,7 +70,8 @@ class Client extends EventEmitter {
} }
return announceUrl return announceUrl
}) })
announce = uniq(announce) // remove duplicates by converting to Set and back
announce = Array.from(new Set(announce))
const webrtcSupport = this._wrtc !== false && (!!this._wrtc || Peer.WEBRTC_SUPPORT) const webrtcSupport = this._wrtc !== false && (!!this._wrtc || Peer.WEBRTC_SUPPORT)

View File

@ -42,7 +42,6 @@
"simple-peer": "^9.0.0", "simple-peer": "^9.0.0",
"simple-websocket": "^8.0.0", "simple-websocket": "^8.0.0",
"string2compact": "^1.1.1", "string2compact": "^1.1.1",
"uniq": "^1.0.1",
"unordered-array-remove": "^1.0.2", "unordered-array-remove": "^1.0.2",
"ws": "^7.0.0" "ws": "^7.0.0"
}, },