isNonEmpty
Checks if a plain object has at least one own enumerable string-keyed property.
null and undefined are treated as empty objects and return false.
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”value is Record<PropertyKey, unknown> — true if the object has at least one own enumerable string-keyed property; false for empty, null, or undefined.
Acts as a type guard: the if branch narrows Record<PropertyKey, unknown> | null | undefined to Record<PropertyKey, unknown>.
Examples
Section titled “Examples”Check if an object has own string-keyed properties
Section titled “Check if an object has own string-keyed properties”Returns true when at least one own enumerable string key is present.
Guard before iterating object keys
Section titled “Guard before iterating object keys”Use isNonEmpty before looping to avoid processing empty objects.
