frontend/.pnpm-store/v3/files/71/a49b223c9631755551c879fc47cb3dd2c3a21f7661443ed7d3302fea7fd558be72fe35e666311cfb68a7217809d9a7b7d6123b57e6f7711a374c7e0ed39068

15 lines
613 B
Plaintext

import { scan } from './scan';
import { takeLast } from './takeLast';
import { defaultIfEmpty } from './defaultIfEmpty';
import { pipe } from '../util/pipe';
export function reduce(accumulator, seed) {
if (arguments.length >= 2) {
return function reduceOperatorFunctionWithSeed(source) {
return pipe(scan(accumulator, seed), takeLast(1), defaultIfEmpty(seed))(source);
};
}
return function reduceOperatorFunction(source) {
return pipe(scan((acc, value, index) => accumulator(acc, value, index + 1)), takeLast(1))(source);
};
}
//# sourceMappingURL=reduce.js.map