You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

10 lines
319 B

4 months ago
/**
* 将多个单个参数的函数合成为一个函数执行顺序为从右到左
* @param fn 第一个函数
* @param rest 剩余函数
* @returns 复合后的函数
*/
export function compose(fn, ...rest) {
return rest.reduce((pre, cur) => (x) => pre(cur(x)), fn);
}
//# sourceMappingURL=compose.js.map