UNPKG

rc-js-util

Version:

A collection of TS and C++ utilities to help writing performant and correct applications, achieved through strict typing and (removable) invariant checking.

29 lines 548 B
/** * @public * Returns true if both `A` and `B` are both null, undefined or 'defined'. Defined is not null and not undefined. * @remarks * See {@link equalityAreConsistentlyDefined}. */ export function equalityAreConsistentlyDefined<T> ( a: T | undefined | null, b: T | undefined | null, ) : boolean { if (a == null) { if (a === undefined) { return b === undefined; } else { return b === null; } } else { return b != null; } }