UNPKG

earljs

Version:

Ergonomic, modern and type-safe assertion library

23 lines (22 loc) 774 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.toBeNullish = exports.toBeDefined = void 0; const format_1 = require("../format"); function toBeDefined(control) { const actualFmt = (0, format_1.formatCompact)(control.actual); control.assert({ success: control.actual != null, reason: `${actualFmt} is not defined`, negatedReason: `${actualFmt} is defined`, }); } exports.toBeDefined = toBeDefined; function toBeNullish(control) { const actualFmt = (0, format_1.formatCompact)(control.actual); control.assert({ success: control.actual == null, reason: `${actualFmt} is not nullish`, negatedReason: `${actualFmt} is nullish`, }); } exports.toBeNullish = toBeNullish;