MCPcopy Index your code
hub / github.com/nodejs/node / reduceLeft

Function reduceLeft

test/fixtures/snapshot/typescript.js:1401–1423  ·  view source on GitHub ↗
(array, f, initial, start, count)

Source from the content-addressed store, hash-verified

1399 }
1400 ts.binarySearchKey = binarySearchKey;
1401 function reduceLeft(array, f, initial, start, count) {
1402 if (array && array.length > 0) {
1403 var size = array.length;
1404 if (size > 0) {
1405 var pos = start === undefined || start < 0 ? 0 : start;
1406 var end = count === undefined || pos + count > size - 1 ? size - 1 : pos + count;
1407 var result = void 0;
1408 if (arguments.length <= 2) {
1409 result = array[pos];
1410 pos++;
1411 }
1412 else {
1413 result = initial;
1414 }
1415 while (pos <= end) {
1416 result = f(result, array[pos], pos);
1417 pos++;
1418 }
1419 return result;
1420 }
1421 }
1422 return initial;
1423 }
1424 ts.reduceLeft = reduceLeft;
1425 var hasOwnProperty = Object.prototype.hasOwnProperty;
1426 /**

Callers 1

composeFunction · 0.85

Calls 1

fFunction · 0.50

Tested by

no test coverage detected