@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
13 lines (12 loc) • 333 B
JavaScript
/** Helper type for single arg function */
/**
* Compose 1 to n functions.
* @param func first function
* @param funcs additional functions
*/
export function compose(func, ...funcs) {
const allFuncs = [func, ...funcs];
return function composed(raw) {
return allFuncs.reduceRight((memo, func) => func(memo), raw);
};
}