1
0
mirror of https://github.com/thangisme/notes.git synced 2024-06-12 13:50:42 +00:00
notes/node_modules/stylelint/lib/utils/validateObjectWithStringArrayProps.js
Patrick Marsceill b7b0d0d7bf
Initial commit
2017-03-09 13:16:08 -05:00

30 lines
652 B
JavaScript

/* @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))
})
}