UNPKG

typescript-nullsafe

Version:
16 lines 530 B
/** * Tests if value1 and value2 are both null or undefined or have the same value */ import { hasNoValue } from "./hasNoValue"; export const hasNoValueOrEquals = (left, right, tester) => { const leftNoValue = hasNoValue(left); const rightNoValue = hasNoValue(right); if (leftNoValue || rightNoValue) { return leftNoValue && rightNoValue; } if (hasNoValue(tester)) { return left === right; } return tester(left, right); }; //# sourceMappingURL=hasNoValueOrEquals.js.map