select.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _filter = require('./internal/filter');
  6. var _filter2 = _interopRequireDefault(_filter);
  7. var _doParallel = require('./internal/doParallel');
  8. var _doParallel2 = _interopRequireDefault(_doParallel);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. /**
  11. * Returns a new array of all the values in `coll` which pass an async truth
  12. * test. This operation is performed in parallel, but the results array will be
  13. * in the same order as the original.
  14. *
  15. * @name filter
  16. * @static
  17. * @memberOf module:Collections
  18. * @method
  19. * @alias select
  20. * @category Collection
  21. * @param {Array|Iterable|Object} coll - A collection to iterate over.
  22. * @param {Function} iteratee - A truth test to apply to each item in `coll`.
  23. * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
  24. * with a boolean argument once it has completed. Invoked with (item, callback).
  25. * @param {Function} [callback] - A callback which is called after all the
  26. * `iteratee` functions have finished. Invoked with (err, results).
  27. * @example
  28. *
  29. * async.filter(['file1','file2','file3'], function(filePath, callback) {
  30. * fs.access(filePath, function(err) {
  31. * callback(null, !err)
  32. * });
  33. * }, function(err, results) {
  34. * // results now equals an array of the existing files
  35. * });
  36. */
  37. exports.default = (0, _doParallel2.default)(_filter2.default);
  38. module.exports = exports['default'];