Created
May 16, 2015 01:38
-
-
Save wilson0x4d/d01a1459c7709be66cc0 to your computer and use it in GitHub Desktop.
JS helpers for consistent callback behavior
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
// helpers for consistent callback behavior | |
__nop = function (err) { if (err) alert(err); }; | |
__cbfix = function (cb) { | |
// for example: cb = __cbfix(cb); | |
return typeof (cb) !== 'function' | |
? __nop | |
: cb; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment