Created
April 22, 2015 18:32
-
-
Save seemikehack/da7d3e42e708ed60d439 to your computer and use it in GitHub Desktop.
Simple assertion library
This file contains 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
// 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