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

Signature TypeScript complète, extraite du fichier util.

typescript

API

Paramètres

Paramètres d'entrée acceptés par cet util.

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

API

Valeur de retour

La valeur retournée par cet util.

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

Usage

Exemples

Extraits de code prêts à coller.

Test nil and blank values

typescript