mirror of
https://github.com/NoFxAiOS/nofx.git
synced 2026-07-01 10:01:21 +08:00
- Multi-AI competition mode (Qwen vs DeepSeek) - Binance Futures integration - AI self-learning mechanism - Professional web dashboard - Complete risk management system
15 lines
460 B
JavaScript
15 lines
460 B
JavaScript
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;
|
|
}
|