MCPcopy Create free account
hub / github.com/dtmilano/AndroidViewClient / reducer

Function reducer

docs/_static/underscore-1.13.1.js:1358–1371  ·  view source on GitHub ↗
(obj, iteratee, memo, initial)

Source from the content-addressed store, hash-verified

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;

Callers 1

createReduceFunction · 0.85

Calls 3

isArrayLikeFunction · 0.85
keysFunction · 0.85
iterateeFunction · 0.85

Tested by

no test coverage detected