Skip to content

Instantly share code, notes, and snippets.

@bendangelo
Created November 3, 2013 22:48
Show Gist options
  • Select an option

  • Save bendangelo/7295767 to your computer and use it in GitHub Desktop.

Select an option

Save bendangelo/7295767 to your computer and use it in GitHub Desktop.
Log and assert wrappers.
function LOG() {
if (window.DEBUG_MODE) try {
console.log.apply(console, arguments);
} catch (e) {}
}
function ASSERT(condition, message) {
if (!condition) {
if(console && typeof console.assert == "function"){
console.assert(condition, message);
} else {
throw "Failed assert: " + message;
}
}
return condition;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment