export function configManager(configFileName: any) { const localConfigFilePath = path.join(process.cwd(), 'config', configFileName); const atlasboardConfigFilePath = path.join(__dirname, '../../config/', configFileName); return extend( readConfigIfExists(atlasboardConfigFilePath), readConfigIfExists(localConfigFilePath), readEnv(configFileName), ); }
function ReadStream (iterator, options) { if (!(this instanceof ReadStream)) return new ReadStream(iterator, options) options = options || {} Readable.call(this, extend(options, { objectMode: true })) this._iterator = iterator this._options = options this.on('end', this.destroy.bind(this, null, null)) }
test('Command line: webtorrent info /path/to/file.torrent', t => { t.plan(3) cp.exec(`${CMD} info ${fixtures.leaves.torrentPath}`, (err, data) => { t.error(err) data = JSON.parse(data) const parsedTorrent = extend(fixtures.leaves.parsedTorrent) delete parsedTorrent.info delete parsedTorrent.infoBuffer delete parsedTorrent.infoHashBuffer t.deepEqual(data, JSON.parse(JSON.stringify(parsedTorrent, undefined, 2))) }) cp.exec(`${CMD} info /bad/path`, err => { t.ok(err instanceof Error) }) })
function parseOptions(options) { return extend({}, defaultOptions, options || {}); }
function spawn(command, args, opts, cb) { const child = cp.spawn(command, args, extend({ stdio: 'inherit' }, opts)) child.on('error', cb) child.on('close', function (code) { if (code !== 0) cb(new Error('non-zero exit code: ' + code)) else cb(null) }) return child }
request.post(extend(params, { encoding: null }), function (err, response, body) {
first.presences[username] = false var header2 = extend(header, { 'conv_id': StringUtils.SCIdentifier(username, self.client.username) })
var rawUser = extend({}, serializedUser, { value: JSON.stringify({ name: 'Hugo',
return extend(opr, { key: reduce(opr.value), value: opr.key }) }) if (multiKey) { if (!Array.isArray(opr.key)) throw new Error('Reducer must return an array of keys for a multiKey index') opr.key.filter(empty).forEach(function (k) { flattened.push(extend(opr, { key: k })) }) return flattened var opts2 = extend({}, opts) opts2.keys = opts2.values = true idb.createReadStream(opts2).pipe(tr)