mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
71785889c8
PR-URL: https://github.com/nodejs/node/pull/55044 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name>
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;
|