123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- 'use strict';
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- var _eachOfSeries = require('./eachOfSeries.js');
- var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
- var _once = require('./internal/once.js');
- var _once2 = _interopRequireDefault(_once);
- var _wrapAsync = require('./internal/wrapAsync.js');
- var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
- var _awaitify = require('./internal/awaitify.js');
- var _awaitify2 = _interopRequireDefault(_awaitify);
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
- function reduce(coll, memo, iteratee, callback) {
- callback = (0, _once2.default)(callback);
- var _iteratee = (0, _wrapAsync2.default)(iteratee);
- return (0, _eachOfSeries2.default)(coll, (x, i, iterCb) => {
- _iteratee(memo, x, (err, v) => {
- memo = v;
- iterCb(err);
- });
- }, err => callback(err, memo));
- }
- exports.default = (0, _awaitify2.default)(reduce, 4);
- module.exports = exports.default;
|