Skip to content

Instantly share code, notes, and snippets.

@seemikehack
Created April 22, 2015 18:32
Show Gist options
  • Save seemikehack/da7d3e42e708ed60d439 to your computer and use it in GitHub Desktop.
Save seemikehack/da7d3e42e708ed60d439 to your computer and use it in GitHub Desktop.
Simple assertion library
// custom assertion library
function AssertException(msg) {
this.msg = msg || 'AssertException';
};
AssertException.prototype.toString = function () {
return 'AssertException: ' + this.msg;
};
function assert(exp, msg) {
if (!exp)
throw new AssertException(msg);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment