Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.8KB

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