UNPKG

typescript-nullsafe

Version:
20 lines 747 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hasNoValueOrEquals = void 0; /** * Tests if value1 and value2 are both null or undefined or have the same value */ const hasNoValue_1 = require("./hasNoValue"); const hasNoValueOrEquals = (left, right, tester) => { const leftNoValue = (0, hasNoValue_1.hasNoValue)(left); const rightNoValue = (0, hasNoValue_1.hasNoValue)(right); if (leftNoValue || rightNoValue) { return leftNoValue && rightNoValue; } if ((0, hasNoValue_1.hasNoValue)(tester)) { return left === right; } return tester(left, right); }; exports.hasNoValueOrEquals = hasNoValueOrEquals; //# sourceMappingURL=hasNoValueOrEquals.js.map