.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / utils / validateObjectWithStringArrayProps.js
1 /* @flow */
2 "use strict";
3
4 const _ = require("lodash");
5
6 /**
7  * Check whether the variable is an object and all it's properties are arrays of string values:
8  *
9  * ignoreProperties = {
10  *   value1: ["item11", "item12", "item13"],
11  *   value2: ["item21", "item22", "item23"],
12  *   value3: ["item31", "item32", "item33"],
13  * }
14  */
15
16 module.exports = function(value /*: Object*/) /*: boolean*/ {
17   if (!_.isPlainObject(value)) {
18     return false;
19   }
20
21   return Object.keys(value).every(key => {
22     if (!_.isArray(value[key])) {
23       return false;
24     }
25
26     // Make sure the array items are strings
27     return value[key].every(item => _.isString(item));
28   });
29 };