@rxap/utilities
Version:
A collection of utility functions, types and interfaces.
53 lines • 1.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.IsNull = IsNull;
exports.IsNotNull = IsNotNull;
/**
* This function checks if the provided value is null.
*
* @template T - The type of the value to be checked. It can be any valid TypeScript type.
*
* @param {T | null} value - The value to be checked. It can be of any type T or null.
*
* @returns {boolean} - The function returns a boolean value. It returns true if the provided value is null, otherwise it returns false.
*
* @example
* IsNull(null); // returns true
* IsNull(123); // returns false
* IsNull("Hello"); // returns false
*
* @export
*/
function IsNull(value) {
return value === null;
}
/**
* This function checks if a given value is not null.
*
* @export
* @template T - The type of the value to be checked. This can be any valid TypeScript type.
* @param {T | null} value - The value to be checked. This can be of type T or null.
* @returns {boolean} - The function returns a boolean value. If the value is not null, it returns true; otherwise, it returns false.
*
* @example
* // returns: true
* IsNotNull(5);
*
* @example
* // returns: false
* IsNotNull(null);
*
* @example
* // returns: true
* IsNotNull("Hello");
*
* @example
* // returns: false
* IsNotNull(undefined);
*
* Note: This function uses the IsNull function to perform the null check. Ensure that the IsNull function is properly defined and imported for this function to work correctly.
*/
function IsNotNull(value) {
return !IsNull(value);
}
//# sourceMappingURL=is-null.js.map