The func-toolkit includes several useful function combinator and utilities. The compinator provided by the func-toolkit can use any iterable object. func-toolkit provides all of these without any dependencies.
Most examples can find on test code.
import { all } from "func-toolkit";
const data = [2, 10, 4, 6];
const isAllEven = all(data, element => element % 2 == 0);
import { andThen } from "func-toolkit";
function f(x) {
return 2 * x;
}
function g(x) {
return x + 2;
}
const fg = andThen(f, g);
fg(3); // 8
import { compose } from "func-toolkit";
function f(x) {
return 2 * x;
}
function g(x) {
return x + 2;
}
const gf = compose(
f,
g
);
gf(4); // 12