Use custom assert in JS library.

The assert was previously provided by Buster.JS which is not available outside
of the test suite.
This commit is contained in:
Stefan Thomas
2012-12-03 19:45:31 -08:00
parent a1ae6c1866
commit 7bda03745e
2 changed files with 14 additions and 8 deletions

View File

@@ -87,13 +87,19 @@ var logObject = function (msg, obj) {
console.log(msg, JSON.stringify(obj, undefined, 2));
};
var assert = function (assertion, msg) {
if (!assertion) {
throw new Error("Assertion failed" + (msg ? ": "+msg : "."));
}
};
exports.trace = trace;
exports.arraySet = arraySet;
exports.hexToString = hexToString;
exports.stringToArray = stringToArray;
exports.stringToHex = stringToHex;
exports.logObject = logObject;
exports.chunkString = chunkString;
exports.logObject = logObject;
exports.assert = assert;
// vim:sw=2:sts=2:ts=8:et