Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

compose.js 1.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = function () /*...args*/{
  6. return _seq2.default.apply(null, (0, _slice2.default)(arguments).reverse());
  7. };
  8. var _seq = require('./seq');
  9. var _seq2 = _interopRequireDefault(_seq);
  10. var _slice = require('./internal/slice');
  11. var _slice2 = _interopRequireDefault(_slice);
  12. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  13. ;
  14. /**
  15. * Creates a function which is a composition of the passed asynchronous
  16. * functions. Each function consumes the return value of the function that
  17. * follows. Composing functions `f()`, `g()`, and `h()` would produce the result
  18. * of `f(g(h()))`, only this version uses callbacks to obtain the return values.
  19. *
  20. * Each function is executed with the `this` binding of the composed function.
  21. *
  22. * @name compose
  23. * @static
  24. * @memberOf module:ControlFlow
  25. * @method
  26. * @category Control Flow
  27. * @param {...AsyncFunction} functions - the asynchronous functions to compose
  28. * @returns {Function} an asynchronous function that is the composed
  29. * asynchronous `functions`
  30. * @example
  31. *
  32. * function add1(n, callback) {
  33. * setTimeout(function () {
  34. * callback(null, n + 1);
  35. * }, 10);
  36. * }
  37. *
  38. * function mul3(n, callback) {
  39. * setTimeout(function () {
  40. * callback(null, n * 3);
  41. * }, 10);
  42. * }
  43. *
  44. * var add1mul3 = async.compose(mul3, add1);
  45. * add1mul3(4, function (err, result) {
  46. * // result now equals 15
  47. * });
  48. */
  49. module.exports = exports['default'];