mirror of https://github.com/nodejs/node.git
23 lines
445 B
JavaScript
23 lines
445 B
JavaScript
'use strict';
|
|
|
|
let error;
|
|
function lazyError() {
|
|
return error ??= require('internal/errors').codes.ERR_INTERNAL_ASSERTION;
|
|
}
|
|
|
|
function assert(value, message) {
|
|
if (!value) {
|
|
const ERR_INTERNAL_ASSERTION = lazyError();
|
|
throw new ERR_INTERNAL_ASSERTION(message);
|
|
}
|
|
}
|
|
|
|
function fail(message) {
|
|
const ERR_INTERNAL_ASSERTION = lazyError();
|
|
throw new ERR_INTERNAL_ASSERTION(message);
|
|
}
|
|
|
|
assert.fail = fail;
|
|
|
|
module.exports = assert;
|