concat.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _doLimit = require('./internal/doLimit');
  6. var _doLimit2 = _interopRequireDefault(_doLimit);
  7. var _concatLimit = require('./concatLimit');
  8. var _concatLimit2 = _interopRequireDefault(_concatLimit);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. /**
  11. * Applies `iteratee` to each item in `coll`, concatenating the results. Returns
  12. * the concatenated list. The `iteratee`s are called in parallel, and the
  13. * results are concatenated as they return. There is no guarantee that the
  14. * results array will be returned in the original order of `coll` passed to the
  15. * `iteratee` function.
  16. *
  17. * @name concat
  18. * @static
  19. * @memberOf module:Collections
  20. * @method
  21. * @category Collection
  22. * @param {Array|Iterable|Object} coll - A collection to iterate over.
  23. * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`,
  24. * which should use an array as its result. Invoked with (item, callback).
  25. * @param {Function} [callback(err)] - A callback which is called after all the
  26. * `iteratee` functions have finished, or an error occurs. Results is an array
  27. * containing the concatenated results of the `iteratee` function. Invoked with
  28. * (err, results).
  29. * @example
  30. *
  31. * async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files) {
  32. * // files is now a list of filenames that exist in the 3 directories
  33. * });
  34. */
  35. exports.default = (0, _doLimit2.default)(_concatLimit2.default, Infinity);
  36. module.exports = exports['default'];