Skip to content

Function: isEmpty()

isEmpty(value): boolean

Defined in: utils.ts:83

Checks whether a value is empty. Returns true for null, undefined, or a string containing only whitespace.

Parameters

value

unknown

The value to check.

Returns

boolean

true if the value is empty, false otherwise.

Example

ts
isEmpty(null)        // true
isEmpty(undefined)   // true
isEmpty('')          // true
isEmpty('   ')       // true
isEmpty('hello')     // false