isNil
A function that checks whether a given argument is null or undefined, and if so, narrows the type of the argument to undefined | null.
Code
Interface
typescript
const isNil: <T>(val: T | null | undefined) => val is null | undefined
Usage
typescript
import { isNil } from '@modern-kit/utils';
isNil(undefined); // true
isNil(null); // true
isNil(1); // false
isNil(false); // false
isNil("str"); // false
isNil({}); // false