applyEach.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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, `fns`, then it will return a function which lets you pass in the
  14. * arguments as if it were a single function call. If more arguments are
  15. * provided, `callback` is required while `args` is still optional.
  16. *
  17. * @name applyEach
  18. * @static
  19. * @memberOf module:ControlFlow
  20. * @method
  21. * @category Control Flow
  22. * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s
  23. * to all call with the same arguments
  24. * @param {...*} [args] - any number of separate arguments to pass to the
  25. * function.
  26. * @param {Function} [callback] - the final argument should be the callback,
  27. * called when all functions have completed processing.
  28. * @returns {Function} - If only the first argument, `fns`, is provided, it will
  29. * return a function which lets you pass in the arguments as if it were a single
  30. * function call. The signature is `(..args, callback)`. If invoked with any
  31. * arguments, `callback` is required.
  32. * @example
  33. *
  34. * async.applyEach([enableSearch, updateSchema], 'bucket', callback);
  35. *
  36. * // partial application example:
  37. * async.each(
  38. * buckets,
  39. * async.applyEach([enableSearch, updateSchema]),
  40. * callback
  41. * );
  42. */
  43. exports.default = (0, _applyEach2.default)(_map2.default);
  44. module.exports = exports['default'];