applyEach.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _applyEach = require('./internal/applyEach');
  6. var _applyEach2 = _interopRequireDefault(_applyEach);
  7. var _map = require('./map');
  8. var _map2 = _interopRequireDefault(_map);
  9. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  10. /**
  11. * Applies the provided arguments to each function in the array, calling
  12. * `callback` after all functions have completed. If you only provide the first
  13. * argument, then it will return a function which lets you pass in the
  14. * arguments as if it were a single function call.
  15. *
  16. * @name applyEach
  17. * @static
  18. * @memberOf module:ControlFlow
  19. * @method
  20. * @category Control Flow
  21. * @param {Array|Iterable|Object} fns - A collection of asynchronous functions to all
  22. * call with the same arguments
  23. * @param {...*} [args] - any number of separate arguments to pass to the
  24. * function.
  25. * @param {Function} [callback] - the final argument should be the callback,
  26. * called when all functions have completed processing.
  27. * @returns {Function} - If only the first argument is provided, it will return
  28. * a function which lets you pass in the arguments as if it were a single
  29. * function call.
  30. * @example
  31. *
  32. * async.applyEach([enableSearch, updateSchema], 'bucket', callback);
  33. *
  34. * // partial application example:
  35. * async.each(
  36. * buckets,
  37. * async.applyEach([enableSearch, updateSchema]),
  38. * callback
  39. * );
  40. */
  41. exports.default = (0, _applyEach2.default)(_map2.default);
  42. module.exports = exports['default'];