PluginProbe
Force Refresh / 2.1.0
Force Refresh v2.1.0
3.2.1 3.2.0 3.1.2 3.1.1 3.1.0 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.2.0 2.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.11.0 2.11.1 2.12.0 All 54 releases
force-refresh / node_modules / handlebars / node_modules / async / reduceRight.js

reduceRight.js in Force Refresh 2.1.0, at node_modules/handlebars/node_modules/async/reduceRight.js

44 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 'use strict';
2
3 Object.defineProperty(exports, "__esModule", {
4 value: true
5 });
6 exports.default = reduceRight;
7
8 var _reduce = require('./reduce');
9
10 var _reduce2 = _interopRequireDefault(_reduce);
11
12 var _slice = require('./internal/slice');
13
14 var _slice2 = _interopRequireDefault(_slice);
15
16 function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18 /**
19 * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
20 *
21 * @name reduceRight
22 * @static
23 * @memberOf module:Collections
24 * @method
25 * @see [async.reduce]{@link module:Collections.reduce}
26 * @alias foldr
27 * @category Collection
28 * @param {Array} array - A collection to iterate over.
29 * @param {*} memo - The initial state of the reduction.
30 * @param {AsyncFunction} iteratee - A function applied to each item in the
31 * array to produce the next step in the reduction.
32 * The `iteratee` should complete with the next state of the reduction.
33 * If the iteratee complete with an error, the reduction is stopped and the
34 * main `callback` is immediately called with the error.
35 * Invoked with (memo, item, callback).
36 * @param {Function} [callback] - A callback which is called after all the
37 * `iteratee` functions have finished. Result is the reduced value. Invoked with
38 * (err, result).
39 */
40 function reduceRight(array, memo, iteratee, callback) {
41 var reversed = (0, _slice2.default)(array).reverse();
42 (0, _reduce2.default)(reversed, memo, iteratee, callback);
43 }
44 module.exports = exports['default'];