Last active
December 21, 2015 05:39
-
-
Save Zyber17/6258851 to your computer and use it in GitHub Desktop.
Which is the more semantically correct fun2?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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