UNPKG

206 BPlain TextView Raw
1import { identity } from '@antv/util';
2
3export function compose<T>(fn?: (x: T) => T, ...rest: ((x: T) => T)[]) {
4 return fn ? rest.reduce((total, current) => (x: T) => current(total(x)), fn) : identity;
5}