Skip to content

Commit

Permalink
chore(mesh-wide): improve isEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
selankon committed Sep 4, 2024
1 parent 09c4559 commit 4af5627
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/utils/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
export function isEmpty(obj: object): boolean {
export function isEmpty(obj: object | null | undefined): boolean {
// Check if the input is null, undefined, or not an object
if (obj == null || typeof obj !== "object") {
return true;
}

// Return true if the object has no own properties
return Object.keys(obj).length === 0;
}

0 comments on commit 4af5627

Please sign in to comment.