mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
359766b2c3
Upcoming lint rule will require a blank line between consecutive functions. Add it in the places where we don't have it already. PR-URL: https://github.com/nodejs/node/pull/30696 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
26 lines
474 B
JavaScript
26 lines
474 B
JavaScript
'use strict';
|
|
|
|
let error;
|
|
function lazyError() {
|
|
if (!error) {
|
|
error = require('internal/errors').codes.ERR_INTERNAL_ASSERTION;
|
|
}
|
|
return error;
|
|
}
|
|
|
|
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;
|