This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/stylus/lib/functions/selector-exists.js
2019-08-11 20:48:02 +02:00

23 lines
507 B
JavaScript

var utils = require('../utils');
/**
* Returns true if the given selector exists.
*
* @param {String} sel
* @return {Boolean}
* @api public
*/
module.exports = function selectorExists(sel) {
utils.assertString(sel, 'selector');
if (!this.__selectorsMap__) {
var Normalizer = require('../visitor/normalizer')
, visitor = new Normalizer(this.root.clone());
visitor.visit(visitor.root);
this.__selectorsMap__ = visitor.map;
}
return sel.string in this.__selectorsMap__;
};