Create a bound composed function. using the redux#compose .
npm i bound-compose
// For example,
// `boundCompose(f, g, h)(b)(...args)` is identical to doing
// `(b, ...args) => f(g(h(b, ...args), ...args), ...args)` .
let result;
result = doSomething1(result, ...args)
result = doSomething2(result, ...args)
result = doSomething3(result, ...args)
// ↓
result = doSomething3(doSomething2(doSomething1(result, ...args), ...args), ...args)
// ↓
const result = boundCompose(doSomething3, doSomething2, doSomething1)(arg)(...args)
// or
const result = boundCompose.left(doSomething1, doSomething2, doSomething3)(arg)(...args)
- Fork it!
- Create your feature branch: git checkout -b my-new-feature
- Commit your changes: git commit -am 'Add some feature'
- Push to the branch: git push origin my-new-feature
- Submit a pull request :D
© sugarshin