Skip to content

Instantly share code, notes, and snippets.

@shesek
Created February 17, 2013 20:25
Show Gist options
  • Save shesek/4973272 to your computer and use it in GitHub Desktop.
Save shesek/4973272 to your computer and use it in GitHub Desktop.
Decorate an synchronous function that returns a value to be asynchronous-like and pass the return value to a callback argument
sync = (fn) -> (a..., cb) ->
try cb null, fn a...
catch e then cb e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment