MCPcopy Create free account
hub / github.com/breck7/scroll / reduce

Function reduce

external/.d3.js:1281–1294  ·  view source on GitHub ↗
(values, reducer, value)

Source from the content-addressed store, hash-verified

1279}
1280
1281function reduce(values, reducer, value) {
1282 if (typeof reducer !== "function") throw new TypeError("reducer is not a function");
1283 const iterator = values[Symbol.iterator]();
1284 let done, next, index = -1;
1285 if (arguments.length < 3) {
1286 ({done, value} = iterator.next());
1287 if (done) return;
1288 ++index;
1289 }
1290 while (({done, value: next} = iterator.next()), !done) {
1291 value = reducer(value, next, ++index, values);
1292 }
1293 return value;
1294}
1295
1296function reverse$1(values) {
1297 if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable");

Callers 3

reducerFunction · 0.70
nestFunction · 0.70
groupSortFunction · 0.70

Calls 2

reducerFunction · 0.85
nextMethod · 0.80

Tested by

no test coverage detected