2016-08-27 03:29:49 +00:00
|
|
|
/* jslint node: true */
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
// ENiGMA½
|
2018-06-21 01:57:06 +00:00
|
|
|
const Config = require('./config.js').get;
|
2018-01-15 19:22:11 +00:00
|
|
|
const Log = require('./logger.js').log;
|
2016-08-27 03:29:49 +00:00
|
|
|
|
|
|
|
// deps
|
|
|
|
const assert = require('assert');
|
|
|
|
|
|
|
|
module.exports = function(condition, message) {
|
2018-06-22 05:15:04 +00:00
|
|
|
if(Config().debug.assertsEnabled) {
|
|
|
|
assert.apply(this, arguments);
|
|
|
|
} else if(!(condition)) {
|
|
|
|
const stack = new Error().stack;
|
|
|
|
Log.error( { condition : condition, stack : stack }, message || 'Assertion failed' );
|
|
|
|
}
|
2016-08-27 03:29:49 +00:00
|
|
|
};
|