Back to Functions

isUndefined

lang

Checks if value is undefined.

Installation

Import
import { isUndefined } from '@tulx/utils';

Source Code

Implementation
/**
 * Checks if value is undefined.
 *
 * @param value - The value to check.
 * @returns Returns true if value is undefined, else false.
 *
 * @example
 * ```ts
 * isUndefined(void 0); // true
 * isUndefined(null); // false
 * ```
 */
export function isUndefined(value: unknown): value is undefined {
  return value === undefined;
}

Example

import { isUndefined } from '@tulx/utils';

isUndefined(void 0); // true
isUndefined(null); // false

Related Functions