🚫 Checks if a value is nullish (null or undefined).

Syntax

TypeScript
import { isNil } from '@opentf/std';

isNil(val: unknown): boolean

Parameters

  • val: The value to check.

Returns

true if the value is null or undefined, false otherwise.

Examples

TypeScript
isNil() //=> true

isNil(undefined) //=> true

isNil(null) //=> true

isNil('') //=> false

isNil(0) //=> false

isNil(false) //=> false

isNil([]) //=> false

isNil({}) //=> false
Last updated on
Edit this page