feat: add new file
This commit is contained in:
14
frontend/node_modules/d3-array/src/reduce.js
generated
vendored
Normal file
14
frontend/node_modules/d3-array/src/reduce.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
export default function reduce(values, reducer, value) {
|
||||
if (typeof reducer !== "function") throw new TypeError("reducer is not a function");
|
||||
const iterator = values[Symbol.iterator]();
|
||||
let done, next, index = -1;
|
||||
if (arguments.length < 3) {
|
||||
({done, value} = iterator.next());
|
||||
if (done) return;
|
||||
++index;
|
||||
}
|
||||
while (({done, value: next} = iterator.next()), !done) {
|
||||
value = reducer(value, next, ++index, values);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
Reference in New Issue
Block a user