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.

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 _doParallel = require('./internal/doParallel');
  10. var _doParallel2 = _interopRequireDefault(_doParallel);
  11. var _findGetResult = require('./internal/findGetResult');
  12. var _findGetResult2 = _interopRequireDefault(_findGetResult);
  13. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  14. /**
  15. * Returns the first value in `coll` that passes an async truth test. The
  16. * `iteratee` is applied in parallel, meaning the first iteratee to return
  17. * `true` will fire the detect `callback` with that result. That means the
  18. * result might not be the first item in the original `coll` (in terms of order)
  19. * that passes the test.
  20. * If order within the original `coll` is important, then look at
  21. * [`detectSeries`]{@link module:Collections.detectSeries}.
  22. *
  23. * @name detect
  24. * @static
  25. * @memberOf module:Collections
  26. * @method
  27. * @alias find
  28. * @category Collections
  29. * @param {Array|Iterable|Object} coll - A collection to iterate over.
  30. * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`.
  31. * The iteratee must complete with a boolean value as its result.
  32. * Invoked with (item, callback).
  33. * @param {Function} [callback] - A callback which is called as soon as any
  34. * iteratee returns `true`, or after all the `iteratee` functions have finished.
  35. * Result will be the first item in the array that passes the truth test
  36. * (iteratee) or the value `undefined` if none passed. Invoked with
  37. * (err, result).
  38. * @example
  39. *
  40. * async.detect(['file1','file2','file3'], function(filePath, callback) {
  41. * fs.access(filePath, function(err) {
  42. * callback(null, !err)
  43. * });
  44. * }, function(err, result) {
  45. * // result now equals the first file in the list that exists
  46. * });
  47. */
  48. exports.default = (0, _doParallel2.default)((0, _createTester2.default)(_identity2.default, _findGetResult2.default));
  49. module.exports = exports['default'];