wallet-core/node_modules/async/internal/applyEach.js

33 lines
915 B
JavaScript
Raw Normal View History

2016-10-10 03:43:44 +02:00
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = applyEach;
2016-11-03 01:33:53 +01:00
var _baseRest = require('lodash/_baseRest');
2016-10-10 03:43:44 +02:00
2016-11-03 01:33:53 +01:00
var _baseRest2 = _interopRequireDefault(_baseRest);
2016-10-10 03:43:44 +02:00
var _initialParams = require('./initialParams');
var _initialParams2 = _interopRequireDefault(_initialParams);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function applyEach(eachfn) {
2016-11-03 01:33:53 +01:00
return (0, _baseRest2.default)(function (fns, args) {
2016-10-10 03:43:44 +02:00
var go = (0, _initialParams2.default)(function (args, callback) {
var that = this;
return eachfn(fns, function (fn, cb) {
fn.apply(that, args.concat([cb]));
}, callback);
});
if (args.length) {
return go.apply(this, args);
} else {
return go;
}
});
}
module.exports = exports['default'];