Last active
February 27, 2016 22:58
-
-
Save catb0t/dc8d8b3b50a930e72588 to your computer and use it in GitHub Desktop.
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
var Assert = function () { | |
"use strict"; | |
var AssertionError = function (msg) { | |
var final = "Assertion failed: " + msg; | |
console.error(final); | |
}; | |
var args = arguments; | |
var res = true; | |
for(var i = 0; i < args.length; i++) { | |
var d = ((i - 1) < 0) ? 0 : i - 1; | |
res = (args[i] === args[d]); | |
if(!res || typeof res === "undefined" || res === null || res !== res) { | |
throw new AssertionError(args[i] + " != " + args[d]); | |
} | |
} | |
var atn = "not_undefined"; | |
try { | |
atn = assert(res); | |
} catch (e) { | |
if(e instanceof ReferenceError) { | |
return true; | |
} | |
} | |
if(typeof atn === "undefined") { | |
return true; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment