detectSeries.js

  1. import detectLimit from './detectLimit';
  2. import doLimit from './internal/doLimit';
  3. /**
  4. * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time.
  5. *
  6. * @name detectSeries
  7. * @static
  8. * @memberOf module:Collections
  9. * @method
  10. * @see [async.detect]{@link module:Collections.detect}
  11. * @alias findSeries
  12. * @category Collections
  13. * @param {Array|Iterable|Object} coll - A collection to iterate over.
  14. * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
  15. * The iteratee must complete with a boolean value as its result.
  16. * Invoked with (item, callback).
  17. * @param {Function} [callback] - A callback which is called as soon as any
  18. * iteratee returns `true`, or after all the `iteratee` functions have finished.
  19. * Result will be the first item in the array that passes the truth test
  20. * (iteratee) or the value `undefined` if none passed. Invoked with
  21. * (err, result).
  22. */
  23. export default doLimit(detectLimit, 1);