deepdash
Version:
➔ 𝐃eep standalone lib / 𝐋odash extension: ✓ eachDeep ✓ filterDeep ✓ mapDeep ✓ reduceDeep ✓ pickDeep ✓ omitDeep ✓ keysDeep ✓ index ✓ condenseDeep ⋮ Parents stack ⋮ Circular check ⋮ Leaves only mode ⋮ Children mode ⋮ cherry-pick ⋮ esm
28 lines (23 loc) • 631 B
JavaScript
var getEachDeep = require('./getEachDeep.js');
function getReduceDeep(_) {
var eachDeep = getEachDeep(_);
function reduceDeep(obj, iteratee, accumulator, options) {
var accumulatorInited = accumulator !== undefined;
eachDeep(
obj,
function (value, key, parent, context) {
if (!accumulatorInited) {
accumulator = value;
accumulatorInited = true;
} else {
accumulator = iteratee(accumulator, value, key, parent, context);
}
},
options
);
return accumulator;
}
return reduceDeep;
}
module.exports = getReduceDeep;
;