chain-fns
Create a chain of responsability by chaining a list of handlers
Install
$ npm install s-chain-fns
Usage
const chainFns = ; const divideByTwo = ;const addOne = ;const stopChainIfOdd = num % 2 === 0 ? : num;const thousandTimes = ; const operations = ; ; //=> 6000 ; //=> 7
API
Function
chainFns(fns) ⇒ Chain a list of handlers with each other
Returns: Function
- First handler chains with the others
Param | Type | Description |
---|---|---|
fns | Function[] |
List of handlers to chain |
fns
Type: Function[]
Each functions should be curried with the first parameter being the next function they are chain with.
const handler1 = { // content of the function}
License
MIT © saxjst