{"name":"css-what","version":"8.0.0","description":"a CSS selector parser","repository":{"type":"git","url":"git+https://github.com/fb55/css-what.git"},"funding":{"type":"github","url":"https://github.com/sponsors/fb55"},"license":"BSD-2-Clause","author":{"name":"Felix Böhm","email":"me@feedic.com","url":"http://feedic.com"},"sideEffects":false,"type":"module","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"main":"./dist/index.js","types":"./dist/index.d.ts","scripts":{"build":"tsc","format":"npm run format:es && npm run format:biome","format:biome":"biome check --write .","format:es":"npm run lint:es -- --fix","lint":"npm run lint:tsc && npm run lint:es && npm run lint:biome","lint:biome":"biome check .","lint:es":"eslint src","lint:tsc":"tsc --noEmit","prepublishOnly":"npm run build","test":"npm run test:vi && npm run lint","test:vi":"vitest run"},"devDependencies":{"@biomejs/biome":"^2.4.7","@eslint/compat":"^2.0.3","@feedic/eslint-config":"^0.3.1","@types/node":"^25.5.0","eslint":"^10.0.3","eslint-config-biome":"^2.1.3","typescript":"^5.9.3","typescript-eslint":"^8.57.1","vitest":"^4.0.18"},"engines":{"node":">=20.19.0"},"gitHead":"f738dc9e6bad5cae403648c31058c8e6afd338a4","_id":"css-what@8.0.0","bugs":{"url":"https://github.com/fb55/css-what/issues"},"homepage":"https://github.com/fb55/css-what#readme","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-DH0Bqq3DNp5tdOReuNyAA+Ev4Y2GS5FMbZpeTLP6C4CDi0h5nL0BmUPChXw3o/qbHLDWHl49sbNqQVY7bMSDdw==","shasum":"237889d60c4afef4736892f39e133ab4c8c21f0c","tarball":"http://registry-npm.ywwl.com/css-what/download/css-what-8.0.0.tgz","fileCount":24,"unpackedSize":540735,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/css-what@8.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCVq8dekGjZJ+mlR8tkpaJYK/8N6d2T5+Z1h1qivspNSAIhAN7PLyssc9K93fGJa1VDE5SOLjxmsHPQnJMA2WymD/rS"}],"size":32838,"noattachment":false,"key":"/css-what/-/css-what-8.0.0.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:b1f9f683-92a1-43d5-a34e-f2834df04613"}},"directories":{},"maintainers":[{"name":"fb55","email":"me@feedic.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/css-what_8.0.0_1773754006762_0.5068974783616311"},"_hasShrinkwrap":false,"readme":"# css-what\n\n[![Node.js CI](https://github.com/fb55/css-what/actions/workflows/nodejs-test.yml/badge.svg)](https://github.com/fb55/css-what/actions/workflows/nodejs-test.yml)\n[![Coverage](https://img.shields.io/coveralls/github/fb55/css-what/master)](https://coveralls.io/github/fb55/css-what?branch=master)\n\nA CSS selector parser.\n\n## Example\n\n```js\nimport * as CSSwhat from \"css-what\";\n\nCSSwhat.parse(\"foo[bar]:baz\")\n\n~> [\n    [\n        { type: \"tag\", name: \"foo\" },\n        {\n            type: \"attribute\",\n            name: \"bar\",\n            action: \"exists\",\n            value: \"\",\n            ignoreCase: null\n        },\n        { type: \"pseudo\", name: \"baz\", data: null }\n    ]\n]\n```\n\n## API\n\n**`CSSwhat.parse(selector)` - Parses `selector`.**\n\nThe function returns a two-dimensional array. The first array represents selectors separated by commas (eg. `sub1, sub2`), the second contains the relevant tokens for that selector. Possible token types are:\n\n| name                | properties                              | example       | output                                                                                   |\n| ------------------- | --------------------------------------- | ------------- | ---------------------------------------------------------------------------------------- |\n| `tag`               | `name`                                  | `div`         | `{ type: 'tag', name: 'div' }`                                                           |\n| `universal`         | -                                       | `*`           | `{ type: 'universal' }`                                                                  |\n| `pseudo`            | `name`, `data`                          | `:name(data)` | `{ type: 'pseudo', name: 'name', data: 'data' }`                                         |\n| `pseudo`            | `name`, `data`                          | `:name`       | `{ type: 'pseudo', name: 'name', data: null }`                                           |\n| `pseudo-element`    | `name`                                  | `::name`      | `{ type: 'pseudo-element', name: 'name' }`                                               |\n| `attribute`         | `name`, `action`, `value`, `ignoreCase` | `[attr]`      | `{ type: 'attribute', name: 'attr', action: 'exists', value: '', ignoreCase: false }`    |\n| `attribute`         | `name`, `action`, `value`, `ignoreCase` | `[attr=val]`  | `{ type: 'attribute', name: 'attr', action: 'equals', value: 'val', ignoreCase: false }` |\n| `attribute`         | `name`, `action`, `value`, `ignoreCase` | `[attr^=val]` | `{ type: 'attribute', name: 'attr', action: 'start', value: 'val', ignoreCase: false }`  |\n| `attribute`         | `name`, `action`, `value`, `ignoreCase` | `[attr$=val]` | `{ type: 'attribute', name: 'attr', action: 'end', value: 'val', ignoreCase: false }`    |\n| `child`             | -                                       | `>`           | `{ type: 'child' }`                                                                      |\n| `parent`            | -                                       | `<`           | `{ type: 'parent' }`                                                                     |\n| `sibling`           | -                                       | `~`           | `{ type: 'sibling' }`                                                                    |\n| `adjacent`          | -                                       | `+`           | `{ type: 'adjacent' }`                                                                   |\n| `descendant`        | -                                       |               | `{ type: 'descendant' }`                                                                 |\n| `column-combinator` | -                                       | `\\|\\|`        | `{ type: 'column-combinator' }`                                                          |\n\n**`CSSwhat.stringify(selector)` - Turns `selector` back into a string.**\n\n---\n\nLicense: BSD-2-Clause\n\n## Security contact information\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security).\nTidelift will coordinate the fix and disclosure.\n","publish_time":1773754006966,"_cnpm_publish_time":1773754006966,"dist-tags":{"latest":"8.0.0"}}