summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common/misc.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/misc.js b/common/misc.js
index a960d35..4d4b346 100644
--- a/common/misc.js
+++ b/common/misc.js
@@ -150,6 +150,17 @@ const matchers = {
};
/*
+ * Facilitates checking if there aren't any keys in object. This does *NOT*
+ * account for pathological cases like redefined properties of Object prototype.
+ */
+function is_object_empty(object)
+{
+ for (const key in object)
+ return false;
+ return true;
+}
+
+/*
* EXPORTS_START
* EXPORT gen_nonce
* EXPORT make_csp_rule
@@ -158,5 +169,6 @@ const matchers = {
* EXPORT open_in_settings
* EXPORT is_privileged_url
* EXPORT matchers
+ * EXPORT is_object_empty
* EXPORTS_END
*/