From 65b2bdc804281794113a2f81e264c7fe4a9ff50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jimmy=20W=C3=A4rting?= Date: Tue, 2 Oct 2018 15:09:02 +0200 Subject: [PATCH] removed xtend --- client.js | 5 ++--- lib/client/http-tracker.js | 3 +-- lib/client/websocket-tracker.js | 3 +-- lib/common.js | 3 +-- package.json | 3 +-- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/client.js b/client.js index ee18dd0..1a8a5f1 100644 --- a/client.js +++ b/client.js @@ -3,7 +3,6 @@ module.exports = Client var Buffer = require('safe-buffer').Buffer var debug = require('debug')('bittorrent-tracker:client') var EventEmitter = require('events').EventEmitter -var extend = require('xtend') var inherits = require('inherits') var once = require('once') var parallel = require('run-parallel') @@ -130,7 +129,7 @@ Client.scrape = function (opts, cb) { if (!opts.infoHash) throw new Error('Option `infoHash` is required') if (!opts.announce) throw new Error('Option `announce` is required') - var clientOpts = extend(opts, { + var clientOpts = Object.assign({}, opts, { infoHash: Array.isArray(opts.infoHash) ? opts.infoHash[0] : opts.infoHash, peerId: Buffer.from('01234567890123456789'), // dummy value port: 6881 // dummy value @@ -291,6 +290,6 @@ Client.prototype._defaultAnnounceOpts = function (opts) { if (opts.uploaded == null) opts.uploaded = 0 if (opts.downloaded == null) opts.downloaded = 0 - if (self._getAnnounceOpts) opts = extend(opts, self._getAnnounceOpts()) + if (self._getAnnounceOpts) opts = Object.assign({}, opts, self._getAnnounceOpts()) return opts } diff --git a/lib/client/http-tracker.js b/lib/client/http-tracker.js index 2cffc2a..66440a6 100644 --- a/lib/client/http-tracker.js +++ b/lib/client/http-tracker.js @@ -4,7 +4,6 @@ var arrayRemove = require('unordered-array-remove') var bencode = require('bencode') var compact2string = require('compact2string') var debug = require('debug')('bittorrent-tracker:http-tracker') -var extend = require('xtend') var get = require('simple-get') var inherits = require('inherits') @@ -47,7 +46,7 @@ HTTPTracker.prototype.announce = function (opts) { var self = this if (self.destroyed) return - var params = extend(opts, { + var params = Object.assign({}, opts, { compact: (opts.compact == null) ? 1 : opts.compact, info_hash: self.client._infoHashBinary, peer_id: self.client._peerIdBinary, diff --git a/lib/client/websocket-tracker.js b/lib/client/websocket-tracker.js index 04e9932..7e30292 100644 --- a/lib/client/websocket-tracker.js +++ b/lib/client/websocket-tracker.js @@ -1,7 +1,6 @@ module.exports = WebSocketTracker var debug = require('debug')('bittorrent-tracker:websocket-tracker') -var extend = require('xtend') var inherits = require('inherits') var Peer = require('simple-peer') var randombytes = require('randombytes') @@ -55,7 +54,7 @@ WebSocketTracker.prototype.announce = function (opts) { return } - var params = extend(opts, { + var params = Object.assign({}, opts, { action: 'announce', info_hash: self.client._infoHashBinary, peer_id: self.client._peerIdBinary diff --git a/lib/common.js b/lib/common.js index 493b14a..90d12f5 100644 --- a/lib/common.js +++ b/lib/common.js @@ -3,7 +3,6 @@ */ var Buffer = require('safe-buffer').Buffer -var extend = require('xtend/mutable') exports.DEFAULT_ANNOUNCE_PEERS = 50 exports.MAX_ANNOUNCE_PEERS = 82 @@ -23,4 +22,4 @@ exports.hexToBinary = function (str) { } var config = require('./common-node') -extend(exports, config) +Object.assign(exports, config) diff --git a/package.json b/package.json index 802ed27..d2ebbd7 100644 --- a/package.json +++ b/package.json @@ -41,8 +41,7 @@ "string2compact": "^1.1.1", "uniq": "^1.0.1", "unordered-array-remove": "^1.0.2", - "ws": "^6.0.0", - "xtend": "^4.0.0" + "ws": "^6.0.0" }, "devDependencies": { "electron-webrtc": "^0.3.0",