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 listUsers () { return shallowClone(db.get('users').value()) }
function create(db, opts) { var sdb = bytespace(db, String(++num), xtend(defs, opts)) if (opts.index) index.install(sdb) if (opts.search) search.install(sdb) return sdb }
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 }
/** * takse response and filer or filters. if filters loops through the array * and calls the filter function one by one the response else just calls the filter * function on response and returns the response from filter function * @class BruffProcessor * @method _runResponseFilter * @static * @param resp {Object} * @param filters {Function|Functions[]} function or array of functions */ static _runResponseFilter(resp, filters) { var newResp = xtend({}, resp); if (Array.isArray(filters)) { for (var i = 0; i < filters.length; i++) { var filterFunction = filters[i]; newResp = filterFunction(newResp); } } else { newResp = filters(newResp); } return newResp; }
request.post(extend(params, { encoding: null }), function (err, response, body) {
xtend(story.story, { 'viewed': story.viewed })
return xtend(alias, { expression: toExpression(domain, alias), actions: toActions(alias)
}, /exists/) const update = shallowClone(expected) update.likes = 'stuff' users.save(update)
this.options = extend({ workerId: uuid.v4() }, defaultOptions, opts);