isEmpty
The isEmpty function checks if a value (object, array, string, Map, or Set) is empty.
Syntax
typescript
isEmpty(value): booleanParameters
| Name | Type | Description |
|---|---|---|
value | any | Value to be checked. |
Return
| Type | Description |
|---|---|
boolean | Returns true if the value is empty, otherwise false. |
Examples
typescript
isEmpty({}); // true
isEmpty([]); // true
isEmpty(''); // true
isEmpty({ a: 1 }); // false
isEmpty([1, 2]); // falseNotes
- Supports objects, arrays, strings, Map, and Set.
- Returns
truefornull.
