{"name":"hast-util-parse-selector","version":"3.0.0","description":"hast utility to create an element from a simple CSS selector","license":"MIT","keywords":["unist","hast","hast-util","util","utility","html","css","selector","parse"],"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"},"funding":{"type":"opencollective","url":"https://opencollective.com/unified"},"author":{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"},"contributors":[{"name":"Titus Wormer","email":"tituswormer@gmail.com","url":"https://wooorm.com"}],"sideEffects":false,"type":"module","main":"index.js","types":"index.d.ts","dependencies":{"@types/hast":"^2.0.0"},"devDependencies":{"@types/tape":"^4.0.0","c8":"^7.0.0","prettier":"^2.0.0","remark-cli":"^9.0.0","remark-preset-wooorm":"^8.0.0","rimraf":"^3.0.0","tape":"^5.0.0","type-coverage":"^2.0.0","typescript":"^4.0.0","xo":"^0.39.0"},"scripts":{"prepack":"npm run build && npm run format","build":"rimraf \"*.d.ts\" && tsc && type-coverage","format":"remark . -qfo && prettier . -w --loglevel warn && xo --fix","test-api":"node test.js","test-coverage":"c8 --check-coverage --branches 100 --functions 100 --lines 100 --statements 100 --reporter lcov node test.js","test":"npm run build && npm run format && npm run test-coverage"},"prettier":{"tabWidth":2,"useTabs":false,"singleQuote":true,"bracketSpacing":false,"semi":false,"trailingComma":"none"},"xo":{"prettier":true,"rules":{"no-var":"off","prefer-arrow-callback":"off"}},"remarkConfig":{"plugins":["preset-wooorm"]},"typeCoverage":{"atLeast":100,"detail":true,"strict":true},"gitHead":"8377fe1a7d342f564ba28a7ea670938784ef1c85","homepage":"https://github.com/syntax-tree/hast-util-parse-selector#readme","_id":"hast-util-parse-selector@3.0.0","_nodeVersion":"15.11.0","_npmVersion":"7.10.0","dist":{"integrity":"sha512-wEXyQobLs5+kkj4UPNXYv7/vIDtvss7rPvyAQ8U7DY4dg/klXy0cUpysY/qn/9ypIsPHKOUCK82wNh9tUWi+7g==","shasum":"097b6fac2dcb98bacc71f7e59cf42bbd4cf9de7e","tarball":"http://registry-npm.ywwl.com/hast-util-parse-selector/download/hast-util-parse-selector-3.0.0.tgz","fileCount":5,"unpackedSize":8503,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJghtdBCRA9TVsSAnZWagAAmakP/1KrA4Hal4E3MuKqVUza\nmx314jGw9A3Xn+1SvTOZPiQe56bmwVerlzcqGqVNYIkXok+uz4ujxqGUAYX1\nxzzMWbSBVu1VbnRtN5jl8nxC7+bkyhRjo4R4cOuZ0ldcmWZUA8GsvqN+C6An\n30J+LdYKiFTMC6CuA4tYVk5ElVOE1TkXYKwV6IKwr9dMb+Uyjcd8pIg/DbkU\nwcvPQEPLQhrB0jQxYNaZyh3jM7EVCWULxBfpdH3VQX7Iy1kQcd7DMhmRFn4f\npeydfw/9koCQqa38z01ScPw8ygeO5yTcjqRmmWCJxGDJUwiiWgbjWcthMUXC\n2e6+DD47RzWYE9n8m4dDIruAt3pkLQU6lgHQMgA9q2/myG/g+cO2mQ2afd/o\n/gmda+v8XAUfw+Vf5c+/GwdOoFlXMQfJh6OEtxgAlybXe/sN/ezQQLjo1WRl\nRjujvEeIRPChcp56GiVE53gPo1qU4UP8wupZa4WSqTJtQrN3AEBCzuEXs9O7\nEGZ8B64XPYqk6yYHfatunbP5MBY5e//3AH0008ZlZebqmsk377YzV7qorBG2\nzAXl6ZH3dK/mj21Wj/LDW6m3idPJgWOmJsYZaa5tednSMA6QiDh0BSSf6sHB\nR5mqu9nHmCMWZK4vQdu1XklfKQK/AZjt3jGhXoIvHgdK1j1eidc6HnNGe1n+\nZXv8\r\n=UfXN\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF9Uu9KAtUVLWGTUFVMeOoFCajz6UfFTs9r42jDzS7CBAiEAlU2lJBTsTuSLUrIHvKTOcqmcg0y0orglWoddCYOzxgM="}],"size":3524,"noattachment":false,"key":"/hast-util-parse-selector/-/hast-util-parse-selector-3.0.0.tgz"},"_npmUser":{"name":"wooorm","email":"tituswormer@gmail.com"},"directories":{},"maintainers":[{"name":"wooorm","email":"tituswormer@gmail.com"},{"name":"kmck","email":"keith@mcknig.ht"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/hast-util-parse-selector_3.0.0_1619449664857_0.9192723180502067"},"_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":1619449664996,"_cnpm_publish_time":1619449664996,"dist-tags":{"latest":"4.0.0"}}