Feature request: `compose`
vorillaz opened this issue · comments
Theodore Vorillas commented
Since most Plexis functions are pure we can create composed functions using closures.
compose
works in a more functional way and provides users with flexibility, creating complex and tricky string operations. compose
actually invokes a series of functions.
@param {Function[]} [funcs] The functions to invoke.
@returns {Function} Returns the new composite function.
Example usage
import compose from '@plexis/compose';
const inc = x => x + 1;
const add = (x, y) => x + y;
const ops = compose(inc, x => add(x, 2));
ops(1); // returns 4;
ops(10); // returns 13;
Aliases
import compose from '@plexis/compose';
import {compose, _do} from 'plexis';
Nguyễn Tuấn Dũng commented
@vorillaz, can I take this ?
Theodore Vorillas commented
@dungwinux Thanks so much for contributing, go for it!