MCPcopy
hub / github.com/reduxjs/redux / compose

Function compose

src/compose.ts:46–61  ·  src/compose.ts::compose
(...funcs: Function[])

Source from the content-addressed store, hash-verified

44export default function compose<R>(...funcs: Function[]): (...args: any[]) => R
45
46export default function compose(...funcs: Function[]) {
47 if (funcs.length === 0) {
48 class="cm">// infer the argument type so it is usable in inference down the line
49 return <T>(arg: T) => arg
50 }
51
52 if (funcs.length === 1) {
53 return funcs[0]
54 }
55
56 return funcs.reduce(
57 (a, b) =>
58 (...args: any) =>
59 a(b(...args))
60 )
61}

Callers 4

compose.spec.tsFile · 0.90
compose.tsFile · 0.85
applyMiddlewareFunction · 0.85
configureStoreFunction · 0.85

Calls 2

aFunction · 0.85
bFunction · 0.85

Tested by

no test coverage detected