Skip to content

Instantly share code, notes, and snippets.

@juliedavila
Last active December 11, 2018 21:44
Show Gist options
  • Select an option

  • Save juliedavila/fed2be8f799f36919cc19f75c101fe9d to your computer and use it in GitHub Desktop.

Select an option

Save juliedavila/fed2be8f799f36919cc19f75c101fe9d to your computer and use it in GitHub Desktop.
sequential cbs
const combineFetch = (fns, cb) => {
const out = []
return id => {
const next = data => {
if (data) out.push(data)
if (fns.length) {
const fn = fns.shift()
return fn(id, next)
}
return cb(out)
}
return next()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment