1.0.1 • Published 7 years ago

bound-compose v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

bound-compose

Build Status Dependency Status Devdependency Status npm version License

Create a bound composed function. using the redux#compose .

npm i bound-compose

Usage

// 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)

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

MIT

© sugarshin