UNPKG

deepdash-es

Version:

➔ 𝐃eep extension for 𝐋odash-es: ✓ eachDeep ✓ filterDeep ✓ pickDeep ✓ omitDeep ✓ keysDeep ✓ index ✓ condenseDeep ⋮ Parent nodes tracking ⋮ Circular references check ⋮ Leaves only mode ⋮ Path as a valid js string or an array ⋮

24 lines (21 loc) 595 B
import getEachDeep from './getEachDeep.js'; export default 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; }