enigma-bbs/core/enigma_assert.js
Bryan Ashby 4881c2123a First pass formatting with Prettier
* Added .prettierrc.json
* Added .prettierignore
* Formatted
2022-06-05 14:04:25 -06:00

19 lines
478 B
JavaScript

/* jslint node: true */
'use strict';
// ENiGMA½
const Config = require('./config.js').get;
const Log = require('./logger.js').log;
// deps
const assert = require('assert');
module.exports = function (condition, message) {
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');
}
};