isEmpty

Commons
stable

Returns true when a value is null, undefined, or a blank string (only whitespace). Typed as accepting any, so it works as a lightweight nil + blank guard across all value types.

API

Signature

Full TypeScript signature sourced from the util file.

typescript

API

Parameters

Input parameters accepted by this util.

val
required
any
The value to test. Numbers, arrays, and objects always return false — only null, undefined, and whitespace-only strings return true.

API

Return value

The value returned by this util.

true for null, undefined, or a string that trims to empty; false for all other values.

Usage

Examples

Ready-to-paste usage snippets.

Test nil and blank values

typescript