(obj, iteratee, memo, initial)
| 1356 | // Wrap code that reassigns argument variables in a separate function than |
| 1357 | // the one that accesses `arguments.length` to avoid a perf hit. (#1991) |
| 1358 | var reducer = function(obj, iteratee, memo, initial) { |
| 1359 | var _keys = !isArrayLike(obj) && keys(obj), |
| 1360 | length = (_keys || obj).length, |
| 1361 | index = dir > 0 ? 0 : length - 1; |
| 1362 | if (!initial) { |
| 1363 | memo = obj[_keys ? _keys[index] : index]; |
| 1364 | index += dir; |
| 1365 | } |
| 1366 | for (; index >= 0 && index < length; index += dir) { |
| 1367 | var currentKey = _keys ? _keys[index] : index; |
| 1368 | memo = iteratee(memo, obj[currentKey], currentKey, obj); |
| 1369 | } |
| 1370 | return memo; |
| 1371 | }; |
| 1372 | |
| 1373 | return function(obj, iteratee, memo, context) { |
| 1374 | var initial = arguments.length >= 3; |
no test coverage detected