{"name":"hast-util-parse-selector","version":"2.2.2","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":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"dependencies":{},"devDependencies":{"browserify":"^16.0.0","nyc":"^14.0.0","prettier":"^1.0.0","remark-cli":"^6.0.0","remark-preset-wooorm":"^5.0.0","tape":"^4.0.0","tinyify":"^2.0.0","xo":"^0.24.0"},"scripts":{"format":"remark . -qfo && prettier --write \"**/*.js\" && xo --fix","build-bundle":"browserify . -s hastUtilParseSelector > hast-util-parse-selector.js","build-mangle":"browserify . -s hastUtilParseSelector -p tinyify > 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,"ignores":["hast-util-parse-selector.js"]},"nyc":{"check-coverage":true,"lines":100,"functions":100,"branches":100},"remarkConfig":{"plugins":["preset-wooorm"]},"gitHead":"24f39499e92c8a28cbdb993e3e3307174bf68baf","homepage":"https://github.com/syntax-tree/hast-util-parse-selector#readme","_id":"hast-util-parse-selector@2.2.2","_nodeVersion":"12.2.0","_npmVersion":"6.9.0","dist":{"integrity":"sha512-jIMtnzrLTjzqgVEQqPEmwEZV+ea4zHRFTP8Z2Utw0I5HuBOXHzUPPQWr6ouJdJqDKLbFU/OEiYwZ79LalZkmmw==","shasum":"66aabccb252c47d94975f50a281446955160380b","tarball":"http://registry-npm.ywwl.com/hast-util-parse-selector/download/hast-util-parse-selector-2.2.2.tgz","fileCount":4,"unpackedSize":7010,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJc6kXvCRA9TVsSAnZWagAAfL8QAKRyoWmnYVknRHZpv3Pn\n1+gMZkrOpbfjmbyjvbdubV6atftOocOOuUThSfYLlErfEZfWr3auKp3P7dXk\nxg1VtKPcKomC5coBfvlfoPLg8KynGTCVDHCyMV4XD768ZeXmNqgAPND5UbJN\nFOo34laIbCW+cGyUIv7uzd56DWhSLY1Gj2bmvtl5ZEXTVKCFZbsbXrlu22YK\n64Ga/MTe5zXdRISD4/nrCzXdHje3vAXutRJgoRsdH/lmbumMp48YEgfPyqok\ndMc3g2gm7ETUG+QmTB5fvuVjLvfLO22VgIcubu8KxouBZuPYyTrVON5LaDsC\nqymUbKSbfgYJuzWgtgvWy/QWzA4KHpZ8A5/P3UnQHGXKGuHvxkmd5T3nrd6s\nGhFqodFii6oVaQjkULPdHzvNGIfQApE4htW1X0qCQnlV8OPqJ5JLDxV/bVyS\nnXp341ZyoDFFkno1OLcTyQOsjyt+26+WNnUtPEvBGJ+urTy9db9KiiQo/Inj\nAYPNuvt/zVqBFRmi1aoubdfeCuvBn6nD9GXiaAhXjTr8lqh8+Scm7Fcd8fbX\nOKdTDuAPdNY5wCkBpUESf4PkMBmqw9726b9KnG4N5bICDDg9QhKus/nhZh5L\n1KI1hbrcQNkbLSf77pcqOO+pPhQXedKu3wFbVtMgzbVerOjQcSKP7wdIeRHV\njdM1\r\n=6d0B\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDHSXweBIEG13NSadYEXWnpQFo6REcszesby1FJzT8twwIhAKvFgara5qJjgJ7VA02e/qyJbdMITounazc5wd5S+1zU"}],"size":2990,"noattachment":false,"key":"/hast-util-parse-selector/-/hast-util-parse-selector-2.2.2.tgz"},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"}],"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-parse-selector_2.2.2_1558857199123_0.9238862599802302"},"_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":1558857199286,"_cnpm_publish_time":1558857199286,"dist-tags":{"latest":"4.0.0"}}