rejectSeries.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _reject2 = require('./internal/reject.js');
  6. var _reject3 = _interopRequireDefault(_reject2);
  7. var _eachOfSeries = require('./eachOfSeries.js');
  8. var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
  9. var _awaitify = require('./internal/awaitify.js');
  10. var _awaitify2 = _interopRequireDefault(_awaitify);
  11. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  12. /**
  13. * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time.
  14. *
  15. * @name rejectSeries
  16. * @static
  17. * @memberOf module:Collections
  18. * @method
  19. * @see [async.reject]{@link module:Collections.reject}
  20. * @category Collection
  21. * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
  22. * @param {Function} iteratee - An async truth test to apply to each item in
  23. * `coll`.
  24. * The should complete with a boolean value as its `result`.
  25. * Invoked with (item, callback).
  26. * @param {Function} [callback] - A callback which is called after all the
  27. * `iteratee` functions have finished. Invoked with (err, results).
  28. * @returns {Promise} a promise, if no callback is passed
  29. */
  30. function rejectSeries(coll, iteratee, callback) {
  31. return (0, _reject3.default)(_eachOfSeries2.default, coll, iteratee, callback);
  32. }
  33. exports.default = (0, _awaitify2.default)(rejectSeries, 3);
  34. module.exports = exports['default'];