stylelint
Version:
A mighty, modern CSS linter.
25 lines (20 loc) • 874 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = optionsMatches;
var _matchesStringOrRegExp = require("./matchesStringOrRegExp");
var _matchesStringOrRegExp2 = _interopRequireDefault(_matchesStringOrRegExp);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Check if an options object's propertyName contains a user-defined string or
* regex that matches the passed in input.
*
* @param {object} options
* @param {string} propertyName - The haystack name
* @param {string} input - The needle
* @return {boolean} If `true`, a match was found
*/
function optionsMatches(options, propertyName, input) {
return !!(options && options[propertyName] && typeof input === "string" && (0, _matchesStringOrRegExp2.default)(input.toLowerCase(), options[propertyName]));
}