2017-05-03 15:35:00 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
|
|
value: true
|
|
|
|
});
|
|
|
|
|
2017-05-24 15:10:37 +02:00
|
|
|
exports.default = function () /*...args*/{
|
|
|
|
return _seq2.default.apply(null, (0, _slice2.default)(arguments).reverse());
|
|
|
|
};
|
|
|
|
|
2017-05-03 15:35:00 +02:00
|
|
|
var _seq = require('./seq');
|
|
|
|
|
|
|
|
var _seq2 = _interopRequireDefault(_seq);
|
|
|
|
|
2017-05-24 15:10:37 +02:00
|
|
|
var _slice = require('./internal/slice');
|
2017-05-03 15:35:00 +02:00
|
|
|
|
2017-05-24 15:10:37 +02:00
|
|
|
var _slice2 = _interopRequireDefault(_slice);
|
2017-05-03 15:35:00 +02:00
|
|
|
|
|
|
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
|
|
|
2017-05-24 15:10:37 +02:00
|
|
|
;
|
|
|
|
|
2017-05-03 15:35:00 +02:00
|
|
|
/**
|
|
|
|
* Creates a function which is a composition of the passed asynchronous
|
|
|
|
* functions. Each function consumes the return value of the function that
|
|
|
|
* follows. Composing functions `f()`, `g()`, and `h()` would produce the result
|
|
|
|
* of `f(g(h()))`, only this version uses callbacks to obtain the return values.
|
|
|
|
*
|
|
|
|
* Each function is executed with the `this` binding of the composed function.
|
|
|
|
*
|
|
|
|
* @name compose
|
|
|
|
* @static
|
|
|
|
* @memberOf module:ControlFlow
|
|
|
|
* @method
|
|
|
|
* @category Control Flow
|
|
|
|
* @param {...AsyncFunction} functions - the asynchronous functions to compose
|
|
|
|
* @returns {Function} an asynchronous function that is the composed
|
|
|
|
* asynchronous `functions`
|
|
|
|
* @example
|
|
|
|
*
|
|
|
|
* function add1(n, callback) {
|
|
|
|
* setTimeout(function () {
|
|
|
|
* callback(null, n + 1);
|
|
|
|
* }, 10);
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* function mul3(n, callback) {
|
|
|
|
* setTimeout(function () {
|
|
|
|
* callback(null, n * 3);
|
|
|
|
* }, 10);
|
|
|
|
* }
|
|
|
|
*
|
|
|
|
* var add1mul3 = async.compose(mul3, add1);
|
|
|
|
* add1mul3(4, function (err, result) {
|
|
|
|
* // result now equals 15
|
|
|
|
* });
|
|
|
|
*/
|
|
|
|
module.exports = exports['default'];
|