npm.io
0.0.3 • Published 7 years ago

chainesis

Licence
MIT
Version
0.0.3
Deps
0
Size
53 kB
Vulns
0
Weekly
0
Stars
3

chainesis

Chain functions to other functions.

Installation

npm

npm install --save chainesis

yarn

yarn add chainesis

API

chain
import { chain } from 'chainesis'

const [hookOnChain, runChain] = chain((runChainArg, next) => {
 // do something
 // pass something to next function
 next(something)
})

// chained to chain
hookOnChain((something, next) => {
 // Do new stuff with something from root function
 next(new stuff)
})

// chained to chain
const [hookOnSecond, hookOff] = hookOnChain((something, next) => {
 // Do new stuff with something from root function
 next(new stuff)
})

// chained to hookOnChain
const [goOnForeverHook, hookOffBranchToo] = hookOnSecond((argsFromHookOnChain, next) => {
 // here we go again!
  next(indefinitely)   
})

License

MIT

Keywords