UNPKG

1.57 kBJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _reject2 = require('./internal/reject');
8
9var _reject3 = _interopRequireDefault(_reject2);
10
11var _eachOfLimit = require('./internal/eachOfLimit');
12
13var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14
15var _awaitify = require('./internal/awaitify');
16
17var _awaitify2 = _interopRequireDefault(_awaitify);
18
19function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
21/**
22 * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a
23 * time.
24 *
25 * @name rejectLimit
26 * @static
27 * @memberOf module:Collections
28 * @method
29 * @see [async.reject]{@link module:Collections.reject}
30 * @category Collection
31 * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 * @param {number} limit - The maximum number of async operations at a time.
33 * @param {Function} iteratee - An async truth test to apply to each item in
34 * `coll`.
35 * The should complete with a boolean value as its `result`.
36 * Invoked with (item, callback).
37 * @param {Function} [callback] - A callback which is called after all the
38 * `iteratee` functions have finished. Invoked with (err, results).
39 * @returns {Promise} a promise, if no callback is passed
40 */
41function rejectLimit(coll, limit, iteratee, callback) {
42 return (0, _reject3.default)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
43}
44exports.default = (0, _awaitify2.default)(rejectLimit, 4);
45module.exports = exports['default'];
\No newline at end of file