UNPKG

@atlaskit/editor-common

Version:

A package that contains common classes and components for editor and renderer

15 lines (14 loc) 425 B
/** 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]; // Ignored via go/ees005 // eslint-disable-next-line @typescript-eslint/no-explicit-any return function composed(raw) { return allFuncs.reduceRight((memo, func) => func(memo), raw); }; }