diff options
author | KayleePop <34007889+KayleePop@users.noreply.github.com> | 2020-03-14 22:51:34 +0300 |
---|---|---|
committer | Kaylee <34007889+KayleePop@users.noreply.github.com> | 2020-03-15 10:17:03 +0300 |
commit | ccb796cc1aa3ea5a38b4f8610e35f852f4187fdc (patch) | |
tree | 30604c8a66410290d77a77c36194f3f065854a6e /lib | |
parent | 7a36c1d4788728653500b86751a0c7888bd31f46 (diff) |
use native Set instead of uniq library
Diffstat (limited to 'lib')
-rw-r--r-- | lib/torrent.js | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/torrent.js b/lib/torrent.js index e6ab569..d1de991 100644 --- a/lib/torrent.js +++ b/lib/torrent.js @@ -22,7 +22,6 @@ const pump = require('pump') const randomIterate = require('random-iterate') const sha1 = require('simple-sha1') const speedometer = require('speedometer') -const uniq = require('uniq') const utMetadata = require('ut_metadata') const utPex = require('ut_pex') // browser exclude const parseRange = require('parse-numeric-range') @@ -267,8 +266,9 @@ class Torrent extends EventEmitter { parsedTorrent.urlList = parsedTorrent.urlList.concat(this.urlList) } - uniq(parsedTorrent.announce) - uniq(parsedTorrent.urlList) + // remove duplicates by converting to Set and back + parsedTorrent.announce = Array.from(new Set(parsedTorrent.announce)) + parsedTorrent.urlList = Array.from(new Set(parsedTorrent.urlList)) Object.assign(this, parsedTorrent) |