a simpler way to create a continuation function with initial arguments and then be called with the remaining arguments
const apply = require('node-apply')
const foo = apply(puts, 'one')
foo('two', 'three')// will return `one two three`
function puts (one, two, three) {
return `${one} ${two} ${three}`
}
const apply = require('node-apply')
const async = require('lasync')
async.waterfall(
[
apply(putsAsync, 'one'),
apply(putsAsync, 'two'),
apply(putsAsync, 'three')
],
(err, res) => {
// res will be 'one - two - three'
}
)
function putsAsync (...args) {
let cb = args.pop()
cb(null, args.reverse().join(' - '))
}
PS: with NodeJS 7 should use the bind
function instead