@lou.codes/predicates
Version:
🧐 Predicate util functions
16 lines (15 loc) • 482 B
JavaScript
import { isType } from "./isType.js";
/**
* `typeof` "null" alias. This "patches" typeof so `null` is not `"object"` but
* `"null"` instead (rejected proposal for lack of backwards compatibility, more
* details [here](https://lou.cx/null-typeof)).
*
* @category Primitives
* @example
* ```typescript
* isNull(null); // true
* isNull(undefined); // false
* ```
* @returns `true` if the given value is a `null`, `false` otherwise.
*/
export const isNull = isType("null");