Skip to content

Instantly share code, notes, and snippets.

@tim-smart
Created July 13, 2012 12:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tim-smart/3104543 to your computer and use it in GitHub Desktop.
Save tim-smart/3104543 to your computer and use it in GitHub Desktop.
function forEachNextTick (obj, fn) {
var keys = Object.keys(obj)
function next () {
var key = keys.pop()
if (!key) return
fn(obj[key])
process.nextTick(next)
}
next()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment