1'use strict'; 2 3let error; 4function lazyError() { 5 if (!error) { 6 error = require('internal/errors').codes.ERR_INTERNAL_ASSERTION; 7 } 8 return error; 9} 10 11function assert(value, message) { 12 if (!value) { 13 const ERR_INTERNAL_ASSERTION = lazyError(); 14 throw new ERR_INTERNAL_ASSERTION(message); 15 } 16} 17 18function fail(message) { 19 const ERR_INTERNAL_ASSERTION = lazyError(); 20 throw new ERR_INTERNAL_ASSERTION(message); 21} 22 23assert.fail = fail; 24 25module.exports = assert; 26