Skip to content

Instantly share code, notes, and snippets.

@wilson0x4d
Created May 16, 2015 01:38
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 wilson0x4d/d01a1459c7709be66cc0 to your computer and use it in GitHub Desktop.
Save wilson0x4d/d01a1459c7709be66cc0 to your computer and use it in GitHub Desktop.
JS helpers for consistent callback behavior
// 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