Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

detectLimit.js 1.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _identity = require('lodash/identity');
  6. var _identity2 = _interopRequireDefault(_identity);
  7. var _createTester = require('./internal/createTester');
  8. var _createTester2 = _interopRequireDefault(_createTester);
  9. var _doParallelLimit = require('./internal/doParallelLimit');
  10. var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit);
  11. var _findGetResult = require('./internal/findGetResult');
  12. var _findGetResult2 = _interopRequireDefault(_findGetResult);
  13. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14. /**
  15. * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a
  16. * time.
  17. *
  18. * @name detectLimit
  19. * @static
  20. * @memberOf module:Collections
  21. * @method
  22. * @see [async.detect]{@link module:Collections.detect}
  23. * @alias findLimit
  24. * @category Collections
  25. * @param {Array|Iterable|Object} coll - A collection to iterate over.
  26. * @param {number} limit - The maximum number of async operations at a time.
  27. * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
  28. * The iteratee must complete with a boolean value as its result.
  29. * Invoked with (item, callback).
  30. * @param {Function} [callback] - A callback which is called as soon as any
  31. * iteratee returns `true`, or after all the `iteratee` functions have finished.
  32. * Result will be the first item in the array that passes the truth test
  33. * (iteratee) or the value `undefined` if none passed. Invoked with
  34. * (err, result).
  35. */
  36. exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(_identity2.default, _findGetResult2.default));
  37. module.exports = exports['default'];