Projekt

Obecné

Profil

Stáhnout (1.52 KB) Statistiky
| Větev: | Revize:
1
'use strict';
2

    
3
Object.defineProperty(exports, "__esModule", {
4
  value: true
5
});
6

    
7
exports.default = function () /*...args*/{
8
  return _seq2.default.apply(null, (0, _slice2.default)(arguments).reverse());
9
};
10

    
11
var _seq = require('./seq');
12

    
13
var _seq2 = _interopRequireDefault(_seq);
14

    
15
var _slice = require('./internal/slice');
16

    
17
var _slice2 = _interopRequireDefault(_slice);
18

    
19
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20

    
21
;
22

    
23
/**
24
 * Creates a function which is a composition of the passed asynchronous
25
 * functions. Each function consumes the return value of the function that
26
 * follows. Composing functions `f()`, `g()`, and `h()` would produce the result
27
 * of `f(g(h()))`, only this version uses callbacks to obtain the return values.
28
 *
29
 * Each function is executed with the `this` binding of the composed function.
30
 *
31
 * @name compose
32
 * @static
33
 * @memberOf module:ControlFlow
34
 * @method
35
 * @category Control Flow
36
 * @param {...AsyncFunction} functions - the asynchronous functions to compose
37
 * @returns {Function} an asynchronous function that is the composed
38
 * asynchronous `functions`
39
 * @example
40
 *
41
 * function add1(n, callback) {
42
 *     setTimeout(function () {
43
 *         callback(null, n + 1);
44
 *     }, 10);
45
 * }
46
 *
47
 * function mul3(n, callback) {
48
 *     setTimeout(function () {
49
 *         callback(null, n * 3);
50
 *     }, 10);
51
 * }
52
 *
53
 * var add1mul3 = async.compose(mul3, add1);
54
 * add1mul3(4, function (err, result) {
55
 *     // result now equals 15
56
 * });
57
 */
58
module.exports = exports['default'];
(18-18/105)