The object to check
True if the object is empty, false otherwise
isPopulatedObject({}) // Returns false
isPopulatedObject({ a: 1 }) // Returns true
isPopulatedObject(null) // Returns false
export function isPopulatedObject(obj: unknown): obj is Record<string, unknown> {
return (
typeof obj === "object" &&
obj !== null &&
Array.isArray(obj) === false &&
Object.entries(obj).length > 0
);
}
Checks if an object is empty.