.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / utils / validateObjectWithStringArrayProps.js
diff --git a/.config/coc/extensions/node_modules/coc-prettier/node_modules/stylelint/lib/utils/validateObjectWithStringArrayProps.js b/.config/coc/extensions/node_modules/coc-prettier/node_modules/stylelint/lib/utils/validateObjectWithStringArrayProps.js
new file mode 100644 (file)
index 0000000..235b6a1
--- /dev/null
@@ -0,0 +1,29 @@
+/* @flow */
+"use strict";
+
+const _ = require("lodash");
+
+/**
+ * Check whether the variable is an object and all it's properties are arrays of string values:
+ *
+ * ignoreProperties = {
+ *   value1: ["item11", "item12", "item13"],
+ *   value2: ["item21", "item22", "item23"],
+ *   value3: ["item31", "item32", "item33"],
+ * }
+ */
+
+module.exports = function(value /*: Object*/) /*: boolean*/ {
+  if (!_.isPlainObject(value)) {
+    return false;
+  }
+
+  return Object.keys(value).every(key => {
+    if (!_.isArray(value[key])) {
+      return false;
+    }
+
+    // Make sure the array items are strings
+    return value[key].every(item => _.isString(item));
+  });
+};