isEmpty
Checks if a value is empty.
Supported types:
null/undefined→ emptystring→ length === 0array→ length === 0Map/Set→ size === 0- plain object → no own enumerable properties
Available since v2.0.0
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | unknown | The value to check |
Returns
Section titled “Returns”value is "" | never[] | ReadonlyMap<never, never> | ReadonlySet<never> | null | undefined — true if the value is considered empty, false otherwise.
Acts as a type guard: the else branch narrows away null, undefined,
empty strings, empty arrays, and empty Map/Set.
Plain empty objects ({}) are not representable as a distinct type in
TypeScript and are therefore not part of the predicate.
Examples
Section titled “Examples”Check empty values
Section titled “Check empty values”Returns true for null, undefined, empty strings, arrays, objects, Maps, and Sets.
Non-empty values
Section titled “Non-empty values”Returns false for values with content.
