How to use the filter function from async
Find comprehensive JavaScript async.filter code examples handpicked from public code repositorys.
59 60 61 62 63 64 65 66 67 68
return path.join(root, item); }); tries = _.uniq(tries); async.filter(tries, path.exists, function (result) { done(null, result); }); }); };
GitHub: ID-BPHC/AUGSD-TD
135 136 137 138 139 140 141 142 143 144
.exec(function(err, rooms) { if (err) { console.log(err); throw err; } async.filter( rooms, function(room, filterCallback) { checkAvailability(room, booking, function(available) { filterCallback(null, available);
+ 7 other calls in file
37 38 39 40 41 42 43 44 45 46
poolOptions.paymentProcessing.enabled) { enabledPools.push(coin); logger.info("PP> Enabled %s for payment processing", coin); } }); async.filter(enabledPools, function (coin, callback) { SetupForPool(poolConfigs[coin], function (setupResults) { logger.debug("PP> Payment processor initialized. Setup results %s", setupResults); callback(null, setupResults); });
154 155 156 157 158 159 160 161 162 163
}) }) } async filter(coll, iteratee) { return new Promise(async (resolve, reject) => { async.filter(coll, iteratee, (err, res) => { if (err) { reject(err) } else { resolve(res)
+ 21 other calls in file
4226 4227 4228 4229 4230 4231 4232 4233 4234 4235
* with a boolean argument once it has completed. Invoked with (item, callback). * @param {Function} [callback] - A callback which is called after all the * `iteratee` functions have finished. Invoked with (err, results). * @example * * async.filter(['file1','file2','file3'], function(filePath, callback) { * fs.access(filePath, function(err) { * callback(null, !err) * }); * }, function(err, results) {
GitHub: gvaldambrini/madam
![gvaldambrini profile picture](/gvaldambrini.png?size=40)
133 134 135 136 137 138 139 140 141 142
callback(null, {documents: documents}); }); }, // check if the required documents already exist on elasticsearch function(res, callback) { async.filter(res.documents, function(doc, filterCallback) { client.exists({ index: mainIndex, type: doc._type, id: doc._id
GitHub: HomieOmie/nodebb-temp
210 211 212 213 214 215 216 217 218 219
const results = await db.sortedSetScores(`uid:${params.uid}:tids_read`, params.tids); const userScores = _.zipObject(params.tids, results); return await async.filter(params.tids, async tid => await doesTidHaveUnblockedUnreadPosts(tid, { blockedUids: params.blockedUids, topicTimestamp: topicScores[tid], userLastReadTimestamp: userScores[tid], }));
+ 7 other calls in file
async.parallel is the most popular function in async (1226 examples)