Skip to content

Instantly share code, notes, and snippets.

@lubien
Last active January 23, 2018 00:22
Show Gist options
  • Select an option

  • Save lubien/5c79156ee96c4ce8116243d02b46ab7e to your computer and use it in GitHub Desktop.

Select an option

Save lubien/5c79156ee96c4ce8116243d02b46ab7e to your computer and use it in GitHub Desktop.
function someHellComputation(initialData, callback) {
fnA(initialData, (err, intermediateData) => {
if (err) return callback(err)
fnB(intermediateData, (err, anotherData) => {
if (err) return callback(err)
fnC(anotherData), (err, finalData) => {
if (err) return callback(err)
callback(null, finalData)
})
})
})
}
someHellComputation(10, (err, data) => {
if (err) return console.error(err)
console.log(data)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment