package
Synchronous function chaining with delay support.
npm install unchainGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Synchronous function chaining with delay support.
$ npm install --save unchainvar chain = require('unchain')
function foo() { console.log('foo') }
function bar() { console.log('bar') }
function baz() { console.log('baz') }
// chain sync functions
chain(foo, bar)()
//=> foo bar
// pass arrays of functions
chain([foo, bar])()
//=> foo bar
// delay some functions
chain(foo, 100, bar, 200, baz)
//=> foo bar (100ms later) baz (200ms later)chain(fn1|delay, [fn2|delay], [fn3|delay, ...])Chains functions from left to right. If a number is specified, the next function in the chain
will be delayed in ms.
MIT © Nicolas Gryman