Skip to content

Instantly share code, notes, and snippets.

@joshuacerbito
Created May 19, 2016 02:05
Show Gist options
  • Save joshuacerbito/0fa5aaf2cc3dec7276a2b30f48c92fb8 to your computer and use it in GitHub Desktop.
Save joshuacerbito/0fa5aaf2cc3dec7276a2b30f48c92fb8 to your computer and use it in GitHub Desktop.
function assert (condition, message) {
if (!condition) {
message = message || "Assertion failed";
if (typeof Error !== "undefined") {
throw new Error(message);
}
throw message; // Fallback
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment