UNPKG

nstdlib-nightly

Version:

Node.js standard library converted to runtime-agnostic ES modules.

28 lines (21 loc) 615 B
// Source: https://github.com/nodejs/node/blob/65eff1eb/lib/internal/assert.js import * as __hoisted_internal_errors__ from "nstdlib/lib/internal/errors"; let error; function lazyError() { if (!error) { error = __hoisted_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; export default assert;