(obj: unknown)
| 4 | * @returns true if the object is empty, false otherwise |
| 5 | */ |
| 6 | export function isEmpty(obj: unknown): boolean { |
| 7 | if (!obj || typeof obj !== "object") { |
| 8 | return true |
| 9 | } |
| 10 | |
| 11 | // Check if it's an array |
| 12 | if (Array.isArray(obj)) { |
| 13 | return obj.length === 0 |
| 14 | } |
| 15 | |
| 16 | // Check if it's an object with no own properties |
| 17 | return Object.keys(obj).length === 0 |
| 18 | } |
no test coverage detected