concat.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _concat = require('./internal/concat');
  6. var _concat2 = _interopRequireDefault(_concat);
  7. var _doParallel = require('./internal/doParallel');
  8. var _doParallel2 = _interopRequireDefault(_doParallel);
  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 {Function} iteratee - A function to apply to each item in `coll`.
  24. * The iteratee is passed a `callback(err, results)` which must be called once
  25. * it has completed with an error (which can be `null`) and an array of results.
  26. * Invoked with (item, callback).
  27. * @param {Function} [callback(err)] - A callback which is called after all the
  28. * `iteratee` functions have finished, or an error occurs. Results is an array
  29. * containing the concatenated results of the `iteratee` function. Invoked with
  30. * (err, results).
  31. * @example
  32. *
  33. * async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files) {
  34. * // files is now a list of filenames that exist in the 3 directories
  35. * });
  36. */
  37. exports.default = (0, _doParallel2.default)(_concat2.default);
  38. module.exports = exports['default'];