We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 7677804 + 44dfc39 commit 0fd3694Copy full SHA for 0fd3694
src/compose.js
@@ -20,7 +20,5 @@ export default function compose(...funcs) {
20
return funcs[0]
21
}
22
23
- const last = funcs[funcs.length - 1]
24
- const rest = funcs.slice(0, -1)
25
- return (...args) => rest.reduceRight((composed, f) => f(composed), last(...args))
+ return funcs.reduce((a, b) => (...args) => a(b(...args)))
26
0 commit comments