Skip to content

Commit

Permalink
Merge pull request #2145 from JoeCortopassi/master
Browse files Browse the repository at this point in the history
Simplify composer
  • Loading branch information
markerikson authored Dec 13, 2016
2 parents 7677804 + 44dfc39 commit 0fd3694
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/compose.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@ export default function compose(...funcs) {
return funcs[0]
}

const last = funcs[funcs.length - 1]
const rest = funcs.slice(0, -1)
return (...args) => rest.reduceRight((composed, f) => f(composed), last(...args))
return funcs.reduce((a, b) => (...args) => a(b(...args)))
}

0 comments on commit 0fd3694

Please sign in to comment.