MCPcopy Create free account
hub / github.com/OBKoro1/web-basics / compose

Function compose

src/js/arrayFunction/array-reduce.js:31–37  ·  view source on GitHub ↗
(...fns)

Source from the content-addressed store, hash-verified

29
30// 从前包裹后面的函数执行 使用闭包缓存函数执行
31const compose = (...fns) => {
32 // 返回一个 前面的函数包裹后面的函数执行
33 return fns.reduce((a, b) => {
34 // 返回一个函数 存储参数
35 return (...args) => a(b(...args))
36 })
37}
38
39
40

Callers 1

array-reduce.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected