UNPKG

1.55 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _filter2 = require('./internal/filter.js');
8
9var _filter3 = _interopRequireDefault(_filter2);
10
11var _eachOfSeries = require('./eachOfSeries.js');
12
13var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
14
15var _awaitify = require('./internal/awaitify.js');
16
17var _awaitify2 = _interopRequireDefault(_awaitify);
18
19function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
21/**
22 * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time.
23 *
24 * @name filterSeries
25 * @static
26 * @memberOf module:Collections
27 * @method
28 * @see [async.filter]{@link module:Collections.filter}
29 * @alias selectSeries
30 * @category Collection
31 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 * @param {Function} iteratee - A truth test to apply to each item in `coll`.
33 * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
34 * with a boolean argument once it has completed. Invoked with (item, callback).
35 * @param {Function} [callback] - A callback which is called after all the
36 * `iteratee` functions have finished. Invoked with (err, results)
37 * @returns {Promise} a promise, if no callback provided
38 */
39function filterSeries(coll, iteratee, callback) {
40 return (0, _filter3.default)(_eachOfSeries2.default, coll, iteratee, callback);
41}
42exports.default = (0, _awaitify2.default)(filterSeries, 3);
43module.exports = exports.default;
\No newline at end of file