diff options
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/misc.tsx | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/utils/misc.tsx b/src/utils/misc.tsx index ec612a9..2b8ccf8 100644 --- a/src/utils/misc.tsx +++ b/src/utils/misc.tsx @@ -75,6 +75,16 @@ export function isObject(obj: unknown): obj is object { } /** + * Check if an object is empty or in other words has no own properties + */ +export function isObjectEmpty(obj: object) { + for (const k in obj) + if (Object.hasOwn(obj, k)) return false; + + return true; +} + +/** * Returns null if value is not a URL, otherwise return URL object. * Avoids having to wrap url checks in a try/catch */ |