{"name":"css-what","version":"6.2.1","author":{"url":"http://feedic.com","name":"Felix Böhm","email":"me@feedic.com"},"license":"BSD-2-Clause","_id":"css-what@6.2.1","maintainers":[{"name":"feedic","email":"me@feedic.com"}],"homepage":"https://github.com/fb55/css-what#readme","bugs":{"url":"https://github.com/fb55/css-what/issues"},"dist":{"shasum":"869907edfe3c2866f3d4284922873382b324b556","tarball":"http://registry-npm.ywwl.com/css-what/download/css-what-6.2.1.tgz","fileCount":38,"integrity":"sha512-efV3anJ1n8GGohPAXF3IVg0wu0AUyBN9px4Giwy7DeQVzzMmNTdo9TtOCJlyoprjNb6Szb/M1kxP86DNFimPIQ==","signatures":[{"sig":"MEUCIQCMBGIXH4DVJJawGM6w0od+IpxYmKmewoyGfmq/Fdr9kAIgFRo+EqmaZUWrJsuemYs7bdS+oaGDJXLgJ1wulNPNaBY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":573531,"size":34289,"noattachment":false,"key":"/css-what/-/css-what-6.2.1.tgz"},"main":"./dist/commonjs/index.js","tshy":{"exclude":["**/*.spec.ts","**/__fixtures__/*","**/__tests__/*","**/__snapshots__/*"],"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":">= 6"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"funding":{"url":"https://github.com/sponsors/fb55"},"gitHead":"15d8df5bc62fb0221dcca112b7d27d0f841ddbd5","scripts":{"lint":"npm run lint:tsc && npm run lint:es && npm run lint:prettier","test":"npm run test:vi && npm run lint","format":"npm run format:es && npm run format:prettier","lint:es":"eslint src","test:vi":"vitest run","lint:tsc":"tsc --noEmit","prettier":"prettier '**/*.{ts,md,json,yml}'","format:es":"npm run lint:es -- --fix","lint:prettier":"npm run prettier -- --check","prepublishOnly":"tshy","format:prettier":"npm run prettier -- --write"},"_npmUser":{"name":"feedic","actor":{"name":"feedic","type":"user","email":"me@feedic.com"},"email":"me@feedic.com"},"prettier":{"tabWidth":4},"repository":{"url":"git+https://github.com/fb55/css-what.git","type":"git"},"_npmVersion":"11.4.2","description":"a CSS selector parser","directories":{},"sideEffects":false,"_nodeVersion":"24.2.0","_hasShrinkwrap":false,"devDependencies":{"tshy":"^3.0.2","eslint":"^8.57.1","vitest":"^3.2.4","prettier":"^3.6.2","typescript":"^5.8.3","@types/node":"^22.15.30","eslint-plugin-n":"^17.20.0","@vitest/coverage-v8":"^3.2.4","eslint-plugin-unicorn":"^55.0.0","eslint-config-prettier":"^10.1.5","@typescript-eslint/parser":"^7.18.0","@typescript-eslint/eslint-plugin":"^7.18.0"},"_npmOperationalInternal":{"tmp":"tmp/css-what_6.2.1_1751108975910_0.44625167224372264","host":"s3://npm-registry-packages-npm-production"},"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":1751108976118,"_cnpm_publish_time":1751108976118,"dist-tags":{"latest":"8.0.0"}}