it('should execute with default concurrency which is 8', () => { const collection = _.times(10); const order = []; const iterator = (result, value) => { order.push(value); return new Aigle(_.noop); }; Aigle.transformLimit(collection, iterator); return Aigle.delay(DELAY).then(() => { assert.deepStrictEqual(order, _.times(8)); }); });
let isNANModule = async function (dir) { let h = path.join(dir, "nan.h"); try { let stat = await fs.stat(h); return stat.isFile(); } catch (e) { _.noop(e); return false; } }
constructor(code, timeoutMs, cb, v3) { this.code = code this.cb = cb || _.noop this.timeoutMs = timeoutMs this.v3 = v3 }
function fetchAndCompileChartForProject(project, callback) { callback = _.isFunction(callback) ? callback : _.noop; console.log('Fetching completed stories for project "' + project.name + '"...'); fetchCompletedStoriesForProject(project.id, function (err, res, stories) { compileChartData(stories, project); callback(); }); }
get(key, defaultResponse) { let getObject; try { getObject = _.reduce(_.split(key, '.'), (o, i) => o[i], Cache.get('config')); } catch (ex) { _.noop(); } if (!_.isUndefined(getObject)) { return getObject; } return (!_.isUndefined(defaultResponse)) ? defaultResponse : undefined; }
this.server.unsuspend(() => { _.noop(); });
it('should not override `value` function if it is not lodash function', () => { const chain = _.noop; Aigle.mixin({ chain }); const val = { a: 1 }; const promise = Aigle.resolve(val); return promise.then((v) => { assert.strictEqual(v, val); assert.strictEqual(promise.value(), val); }); });
it("Should read a file from disk", (done) => { filestore.saveFile('image1', testFile('sample_image.png')) .then((result) => { let filename = result.file; let deferred = Q.defer(); let istream = filestore.stream(filename); assertIsStream(istream); istream.on('data', _.noop); istream.on('error', (e) => deferred.reject(e)); istream.on('end', () => deferred.resolve()); return deferred.promise; }) .should.be.fulfilled .notify(done); })
/* * Cleanups the containers in the pool * * 1) Empty the list of available containers * 2) Clean up every container who was in there */ cleanup(cb) { log.debug("[pool] cleaning up all containers") cb = cb || _.noop const runningContainersCleanups = this.availableContainers.map(c => c.cleanup.bind(c)) const bootingContainersCleanups = this.bootingContainers.map(c => c.cleanup.bind(c)) this.availableContainers.length = 0 return async.parallel(runningContainersCleanups.concat(bootingContainersCleanups), err => cb(err)); }
/* * Asynchronously runs a job in the pool. */ executeJob (job, cb) { cb = cb || _.noop if (_.isEmpty(this.availableContainers)) { log.debug("[pool] No container available, adding a new job to the queue") this.waitingJobs.push(job) } else { this._executeJob(job, cb); } }
top.catch(_.noop).then(function () { return Promise.try(f); }).finally(function () { length--; })
let isNodeJSProject = async function (dir) { let pjson = path.join(dir, "package.json"); let node_modules = path.join(dir, "node_modules"); try { let stat = await fs.stat(pjson); if (stat.isFile()) { return true; } stat = await fs.stat(node_modules); if (stat.isDirectory()) { return true; } } catch (e) { _.noop(e); } return false; }
top .catch(_.noop) .then(() => { return Promise.try(f); }) .finally(() => { length--; })
// Still using self here because of intervals. query() { return _.noop(); }