isEmpty
Checks if a plain object has no own enumerable string-keyed properties.
null and undefined are treated as empty objects and return true.
Symbol-keyed properties are not counted. Use Object.getOwnPropertySymbols
separately if symbol keys matter for your use case.
Available since v2.0.3
Import
Section titled “Import”Signature
Section titled “Signature”Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
value | Record<PropertyKey, unknown> | null | undefined | The object to check |
Returns
Section titled “Returns”boolean — true if the object has no own enumerable string-keyed properties, or if value is null/undefined
Examples
Section titled “Examples”Check if an object has no own string-keyed properties
Section titled “Check if an object has no own string-keyed properties”Returns true for {}. Symbol-keyed properties are not counted.
Symbol keys are not counted
Section titled “Symbol keys are not counted”An object with only symbol-keyed properties is considered empty.
