From 8614e176334232fb5288a5b3255d2daa8245061a Mon Sep 17 00:00:00 2001 From: V Date: Tue, 5 Sep 2023 20:10:42 +0200 Subject: Fix some plugins wrongly displaying the settings cog --- src/utils/misc.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/utils/misc.tsx') 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 @@ -74,6 +74,16 @@ export function isObject(obj: unknown): obj is object { return typeof obj === "object" && obj !== null && !Array.isArray(obj); } +/** + * 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 -- cgit