in-selector

is a given id/classname/tag in a css selector string

Usage no npm install needed!

<script type="module">
  import inSelector from 'https://cdn.skypack.dev/in-selector';
</script>

README

in-selector

npm Node.js CI status

is a given id/classname/tag in a css selector string

Installation

npm i in-selector

or

yarn add in-selector

Usage

const { inSelector } = require( 'in-selector' )

inSelector( '.a', '.a, .b' ) // -> true, check class
inSelector( '#b', '#a, #b:hover' ) // -> true, check id
inSelector( 'div', '.klass > div' ) // -> true, check tag
inSelector( '*', 'html *, body' ) // -> true, check universal

License

MIT