PATH:
opt
/
bitninja-dispatcher
/
node_modules
/
async
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _eachSeries = require('./eachSeries.js'); var _eachSeries2 = _interopRequireDefault(_eachSeries); var _wrapAsync = require('./internal/wrapAsync.js'); var _wrapAsync2 = _interopRequireDefault(_wrapAsync); var _awaitify = require('./internal/awaitify.js'); var _awaitify2 = _interopRequireDefault(_awaitify); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } /** * It runs each task in series but stops whenever any of the functions were * successful. If one of the tasks were successful, the `callback` will be * passed the result of the successful task. If all tasks fail, the callback * will be passed the error and result (if any) of the final attempt. * * @name tryEach * @static * @memberOf module:ControlFlow * @method * @category Control Flow * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing functions to * run, each function is passed a `callback(err, result)` it must call on * completion with an error `err` (which can be `null`) and an optional `result` * value. * @param {Function} [callback] - An optional callback which is called when one * of the tasks has succeeded, or all have failed. It receives the `err` and * `result` arguments of the last attempt at completing the `task`. Invoked with * (err, results). * @returns {Promise} a promise, if no callback is passed * @example * async.tryEach([ * function getDataFromFirstWebsite(callback) { * // Try getting the data from the first website * callback(err, data); * }, * function getDataFromSecondWebsite(callback) { * // First website failed, * // Try getting the data from the backup website * callback(err, data); * } * ], * // optional callback * function(err, results) { * Now do something with the data. * }); * */ function tryEach(tasks, callback) { var error = null; var result; return (0, _eachSeries2.default)(tasks, (task, taskCb) => { (0, _wrapAsync2.default)(task)((err, ...args) => { if (err === false) return taskCb(err); if (args.length < 2) { [result] = args; } else { result = args; } error = err; taskCb(err ? null : {}); }); }, () => callback(error, result)); } exports.default = (0, _awaitify2.default)(tryEach); module.exports = exports['default'];
[-] concatLimit.js
[edit]
[-] concatSeries.js
[edit]
[-] everySeries.js
[edit]
[-] whilst.js
[edit]
[-] groupBySeries.js
[edit]
[-] asyncify.js
[edit]
[-] auto.js
[edit]
[-] find.js
[edit]
[-] concat.js
[edit]
[-] mapLimit.js
[edit]
[-] allSeries.js
[edit]
[-] tryEach.js
[edit]
[-] detectLimit.js
[edit]
[-] select.js
[edit]
[-] wrapSync.js
[edit]
[-] reflect.js
[edit]
[-] series.js
[edit]
[-] transform.js
[edit]
[-] autoInject.js
[edit]
[-] forEachLimit.js
[edit]
[-] detectSeries.js
[edit]
[-] unmemoize.js
[edit]
[-] reduce.js
[edit]
[-] memoize.js
[edit]
[+]
..
[-] doWhilst.js
[edit]
[-] everyLimit.js
[edit]
[-] flatMapLimit.js
[edit]
[-] priorityQueue.js
[edit]
[-] selectLimit.js
[edit]
[-] timesLimit.js
[edit]
[-] mapValuesSeries.js
[edit]
[-] queue.js
[edit]
[-] forEach.js
[edit]
[-] reflectAll.js
[edit]
[-] cargo.js
[edit]
[-] parallelLimit.js
[edit]
[-] some.js
[edit]
[-] inject.js
[edit]
[-] mapValues.js
[edit]
[-] all.js
[edit]
[-] anySeries.js
[edit]
[-] seq.js
[edit]
[-] cargoQueue.js
[edit]
[-] package.json
[edit]
[-] findLimit.js
[edit]
[-] forever.js
[edit]
[-] detect.js
[edit]
[-] rejectLimit.js
[edit]
[-] retry.js
[edit]
[-] timeout.js
[edit]
[-] forEachOfSeries.js
[edit]
[-] eachOfLimit.js
[edit]
[-] nextTick.js
[edit]
[-] parallel.js
[edit]
[-] foldl.js
[edit]
[-] waterfall.js
[edit]
[-] rejectSeries.js
[edit]
[-] dir.js
[edit]
[-] reduceRight.js
[edit]
[-] flatMap.js
[edit]
[-] times.js
[edit]
[-] someSeries.js
[edit]
[-] setImmediate.js
[edit]
[-] anyLimit.js
[edit]
[-] filterLimit.js
[edit]
[-] findSeries.js
[edit]
[-] applyEach.js
[edit]
[-] groupBy.js
[edit]
[-] eachOf.js
[edit]
[-] retryable.js
[edit]
[-] flatMapSeries.js
[edit]
[-] during.js
[edit]
[-] apply.js
[edit]
[-] forEachOf.js
[edit]
[-] index.js
[edit]
[-] someLimit.js
[edit]
[-] foldr.js
[edit]
[-] eachSeries.js
[edit]
[-] groupByLimit.js
[edit]
[-] race.js
[edit]
[-] reject.js
[edit]
[-] timesSeries.js
[edit]
[-] sortBy.js
[edit]
[-] doUntil.js
[edit]
[-] constant.js
[edit]
[-] ensureAsync.js
[edit]
[-] any.js
[edit]
[+]
internal
[-] map.js
[edit]
[-] filter.js
[edit]
[-] mapValuesLimit.js
[edit]
[-] every.js
[edit]
[-] compose.js
[edit]
[-] selectSeries.js
[edit]
[-] forEachOfLimit.js
[edit]
[-] filterSeries.js
[edit]
[-] each.js
[edit]
[-] eachLimit.js
[edit]
[-] README.md
[edit]
[-] eachOfSeries.js
[edit]
[-] applyEachSeries.js
[edit]
[-] bower.json
[edit]
[-] mapSeries.js
[edit]
[-] until.js
[edit]
[+]
dist
[-] forEachSeries.js
[edit]
[-] log.js
[edit]
[-] doDuring.js
[edit]
[-] LICENSE
[edit]
[-] CHANGELOG.md
[edit]
[-] allLimit.js
[edit]