diff options
author | Feross Aboukhadijeh <feross@feross.org> | 2016-01-15 04:06:05 +0300 |
---|---|---|
committer | Feross Aboukhadijeh <feross@feross.org> | 2016-01-15 04:06:05 +0300 |
commit | 6f89456317a5383d07e5041b049497c9f5151335 (patch) | |
tree | 9de23ea297310315fb8adc6711de6802fa4f48d1 /index.js | |
parent | 816d6972d87a77d2569e3e311d6aa031e1fc369c (diff) |
style
Diffstat (limited to 'index.js')
-rw-r--r-- | index.js | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -163,11 +163,8 @@ WebTorrent.prototype.download = function (torrentId, opts, ontorrent) { var self = this if (self.destroyed) throw new Error('client is destroyed') if (typeof opts === 'function') return self.add(torrentId, null, opts) + opts = opts ? extend(opts) : {} debug('add') - if (!opts) opts = {} - else opts = extend(opts) - - opts.client = self var torrent = self.get(torrentId) @@ -179,6 +176,7 @@ WebTorrent.prototype.download = function (torrentId, opts, ontorrent) { if (torrent.ready) process.nextTick(_ontorrent) else torrent.on('ready', _ontorrent) } else { + opts.client = self torrent = new Torrent(torrentId, opts) self.torrents.push(torrent) @@ -210,9 +208,8 @@ WebTorrent.prototype.seed = function (input, opts, onseed) { var self = this if (self.destroyed) throw new Error('client is destroyed') if (typeof opts === 'function') return self.seed(input, null, opts) + opts = opts ? extend(opts) : {} debug('seed') - if (!opts) opts = {} - else opts = extend(opts) // When seeding from filesystem, initialize store from that path (avoids a copy) if (typeof input === 'string') opts.path = path.dirname(input) |