findSeries.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _detectLimit = require('./detectLimit');
  6. var _detectLimit2 = _interopRequireDefault(_detectLimit);
  7. var _doLimit = require('./internal/doLimit');
  8. var _doLimit2 = _interopRequireDefault(_doLimit);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. /**
  11. * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
  12. *
  13. * @name detectSeries
  14. * @static
  15. * @memberOf module:Collections
  16. * @method
  17. * @see [async.detect]{@link module:Collections.detect}
  18. * @alias findSeries
  19. * @category Collections
  20. * @param {Array|Iterable|Object} coll - A collection to iterate over.
  21. * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
  22. * The iteratee must complete with a boolean value as its result.
  23. * Invoked with (item, callback).
  24. * @param {Function} [callback] - A callback which is called as soon as any
  25. * iteratee returns `true`, or after all the `iteratee` functions have finished.
  26. * Result will be the first item in the array that passes the truth test
  27. * (iteratee) or the value `undefined` if none passed. Invoked with
  28. * (err, result).
  29. */
  30. exports.default = (0, _doLimit2.default)(_detectLimit2.default, 1);
  31. module.exports = exports['default'];