{"name":"hast-util-parse-selector","version":"2.1.1","description":"Parse a simple CSS selector to a HAST node","license":"MIT","keywords":["hast","rehype","selector","parse","css","html"],"repository":{"type":"git","url":"git+https://github.com/syntax-tree/hast-util-parse-selector.git"},"bugs":{"url":"https://github.com/syntax-tree/hast-util-parse-selector/issues"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"http://wooorm.com"}],"files":["index.js"],"dependencies":{},"devDependencies":{"browserify":"^16.0.0","esmangle":"^1.0.0","nyc":"^12.0.0","prettier":"^1.13.5","remark-cli":"^5.0.0","remark-preset-wooorm":"^4.0.0","tape":"^4.0.0","xo":"^0.21.0"},"scripts":{"format":"remark . -qfo && prettier --write '**/*.js' && xo --fix","build-bundle":"browserify index.js --bare -s hastUtilParseSelector > hast-util-parse-selector.js","build-mangle":"esmangle hast-util-parse-selector.js > hast-util-parse-selector.min.js","build":"npm run build-bundle && npm run build-mangle","test-api":"node test","test-coverage":"nyc --reporter lcov tape test.js","test":"npm run format && npm run build && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"esnext":false,"rules":{"max-depth":"off"},"ignores":["hast-util-parse-selector.js"]},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"cf51814156f9ad62ef97b87545b861418be7aad5","homepage":"https://github.com/syntax-tree/hast-util-parse-selector#readme","_id":"hast-util-parse-selector@2.1.1","_npmVersion":"6.1.0","_nodeVersion":"10.0.0","_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"dist":{"integrity":"sha512-FlrdvixBzVHYSqtvGAl0wjH1hiCY5NEfs+zfFNAZNWKMVj4pH6x+uPPyrhvzU3NrwOqYVX6Essv4d5n+0b6faA==","shasum":"fc06985272f5d204a25187f002bb916521e74f3a","tarball":"http://registry-npm.ywwl.com/hast-util-parse-selector/download/hast-util-parse-selector-2.1.1.tgz","fileCount":4,"unpackedSize":5730,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbKqZ9CRA9TVsSAnZWagAAp3gP/1mAXaaN2A6XkN5JkP4e\nRDo0Sti79q+fYaE0qELCIt0EY6uW8MkeEL5Ed8ulxm1qD7e3PLznHQd9H0rV\nq/uByYaGr7hq/BjS7zQ7n7q67GAfolNdbnaTPFqTTdM4v/kz6+uSLDCcACyt\n1VxWIGUi/TsU+SuvimFYoZ5l0ystWijaOAKZlATJiGpf72dKDEP0ACIQNFx9\ncRUhbKBNPkfspm+kkyBFyRRXbk7/KkCIv8A3VZQ2+dJck311p95iio2psiT5\nzjEqflzlrW9Jwjm0GQkABMY6XJ5Y6cN4Vi9PQqLbtWIkPNB/c4yPz9vAFsRv\nA1AiPy/zJ6WkgzzrufdBXJrvvl3ZanxM+vT1yDGkqig0fWwbaY/FXtHxlqZu\naGy1RwXa1bfiq1zODowgtPKZGl/SA7Kt0drW9STmE77xHzs3MGmU4TmnZAYL\nUwEksWt3XTSHZIQD4DQRt6nAfK/iarx18jahwstvbAAGBWYSBR3xawzknqI+\n+vpICytO1y0V1ob5Qvvejyi/YCHxCfJKSXj/ujKb5koNt3av0KBP1HlhieKa\n0XQa8VwwnmnP3vB4yzir4SU8GMH+PNdlifIvjAwRWZ1ZgRRAUI7cUy7z5tJT\nEDCY7dLMwbGXN729nYCXXTm/M8NM7hOOhcsw3QmvAwqWwEgz1oem/QmRE5F8\nLUYE\r\n=mbD4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDYA6yKNHQMlmRXiZ2ZynUaIn13IImP9c8wBjV9RMerDwIhANwfpHvKaDecwIN7dVM61KsvANanDdhGfdnpIfhotoiV"}],"size":2626,"noattachment":false,"key":"/hast-util-parse-selector/-/hast-util-parse-selector-2.1.1.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-parse-selector_2.1.1_1529521788603_0.13507832788939367"},"_hasShrinkwrap":false,"readme":"# hast-util-parse-selector\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[hast][] utility to create an element from a simple CSS selector.\n\n## Contents\n\n*   [What is this?](#what-is-this)\n*   [When should I use this?](#when-should-i-use-this)\n*   [Install](#install)\n*   [Use](#use)\n*   [API](#api)\n    *   [`parseSelector(selector?[, defaultTagName])`](#parseselectorselector-defaulttagname)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Security](#security)\n*   [Related](#related)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis package is a tiny utility that helps create elements.\n\n## When should I use this?\n\nThis utility is super niche.\nYou probably want the more powerful [`hastscript`][hastscript] or\n[`hast-util-from-selector`][hast-util-from-selector]\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install hast-util-parse-selector\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {parseSelector} from 'https://esm.sh/hast-util-parse-selector@4'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n<script type=\"module\">\n  import {parseSelector} from 'https://esm.sh/hast-util-parse-selector@4?bundle'\n</script>\n```\n\n## Use\n\n```js\nimport {parseSelector} from 'hast-util-parse-selector'\n\nconsole.log(parseSelector('.quux#bar.baz.qux'))\n```\n\nYields:\n\n```js\n{ type: 'element',\n  tagName: 'div',\n  properties: { id: 'bar', className: [ 'quux', 'baz', 'qux' ] },\n  children: [] }\n```\n\n## API\n\nThis package exports the identifier [`parseSelector`][api-parse-selector].\nThere is no default export.\n\n### `parseSelector(selector?[, defaultTagName])`\n\nCreate a hast element from a simple CSS selector.\n\n###### Parameters\n\n*   `selector` (`string`, optional)\n    —  simple CSS selector, can contain a tag name (`foo`), classes (`.bar`),\n    and an ID (`#baz`), multiple classes are allowed, uses the last ID if\n    multiple IDs are found\n*   `defaultTagName` (`string`, default: `'div'`)\n    — tag name to use if `selector` does not specify one\n\n###### Returns\n\nBuilt element ([`Element`][element]).\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line,\n`hast-util-parse-selector@^4`, compatible with Node.js 16.\n\n## Security\n\nImproper use of the `selector` or `defaultTagName` can open you up to a\n[cross-site scripting (XSS)][xss] attack as the value of `tagName`, when\nresolving to `script`, injects a `script` element into the syntax tree.\n\nDo not use user input in `selector` or use\n[`hast-util-santize`][hast-util-sanitize].\n\n## Related\n\n*   [`hast-util-from-selector`](https://github.com/syntax-tree/hast-util-from-selector)\n    — parse complex CSS selectors to nodes\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n<!-- Definitions -->\n\n[build-badge]: https://github.com/syntax-tree/hast-util-parse-selector/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/hast-util-parse-selector/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/hast-util-parse-selector.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/hast-util-parse-selector\n\n[downloads-badge]: https://img.shields.io/npm/dm/hast-util-parse-selector.svg\n\n[downloads]: https://www.npmjs.com/package/hast-util-parse-selector\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size&query=$.size.compressedSize&url=https://deno.bundlejs.com/?q=hast-util-parse-selector\n\n[size]: https://bundlejs.com/?q=hast-util-parse-selector\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[hast]: https://github.com/syntax-tree/hast\n\n[hast-util-sanitize]: https://github.com/syntax-tree/hast-util-sanitize\n\n[hastscript]: https://github.com/syntax-tree/hastscript\n\n[hast-util-from-selector]: https://github.com/syntax-tree/hast-util-from-selector\n\n[element]: https://github.com/syntax-tree/hast#element\n\n[xss]: https://en.wikipedia.org/wiki/Cross-site_scripting\n\n[api-parse-selector]: #parseselectorselector-defaulttagname\n","publish_time":1529521788694,"_cnpm_publish_time":1529521788694,"dist-tags":{"latest":"4.0.0"}}