Skip to content

Instantly share code, notes, and snippets.

@Zyber17
Last active December 21, 2015 05:39
Show Gist options
  • Save Zyber17/6258851 to your computer and use it in GitHub Desktop.
Save Zyber17/6258851 to your computer and use it in GitHub Desktop.
Which is the more semantically correct fun2?
fun1 = ->
fun2 true, (err, resp) ->
if !err
doStuff()
else
console.log "Error: #{err}"
res.end JSON.stringify err
fun2 = (val, callback) ->
if val
#The line below (see: null)
callback null, 'okay'
#The line above
else
callback 'error', null
fun2 = (val, callback) ->
if val
#The line below (see: false)
callback false, 'okay'
#The line above
else
callback 'error', null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment