1.0.1 • Published 4 years ago
@jswork/reduce-fns v1.0.1
reduce-fns
Generate the reduceable function.
installation
npm install @jswork/reduce-fns
usage
import reduceFns from '@jswork/reduce-fns';
const sum = (a, b) => a + b;
const mul = (a, b) => a * b;
const sumAll = reduceFns(
() => 0,
(args) => args[0],
sum
);
const mulAll = reduceFns(
() => 1,
(args) => args[0],
mul
);
console.log(sumAll(1, 2, 3)) // 6
console.log(mulAll(1, 2, 3, 4, 5)) // 120
license
Code released under the MIT license.