{"_id":"@danielcobo/uniqueselector","_rev":"2-9c9f677f7c4c86cf83fd1b8aad7029f0","name":"@danielcobo/uniqueselector","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@danielcobo/uniqueselector","version":"1.0.0","description":"Get unique selector for given element","main":"src/index.js","scripts":{"test":"jest --env=jsdom --collectCoverage --runInBand","testing":"jest --watch --collectCoverage --runInBand","mutation":"npx stryker run","docs":"docs","patch":"git push && npm version patch && npm publish","minor":"git push && npm version minor && npm publish","major":"git push && npm version major && npm publish","rollup":"rollup -c","prepublishOnly":"rollup -c"},"repository":{"type":"git","url":"git+https://github.com/danielcobo/uniqueselector.git"},"author":{"name":"Daniel Cobo","url":"https://danielcobo.com/"},"license":"MIT","devDependencies":{"@danielcobo/docs":"^1.0.16","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@stryker-mutator/core":"^5.4.1","@stryker-mutator/jest-runner":"^5.4.1","jest":"^27.2.5","rollup":"^2.56.3","rollup-plugin-terser":"^7.0.2"},"dependencies":{"@danielcobo/rmtrailing":"^1.0.7"},"gitHead":"29051cc5937f533f5009cdc6c48ac4e37d5c2179","bugs":{"url":"https://github.com/danielcobo/uniqueselector/issues"},"homepage":"https://github.com/danielcobo/uniqueselector#readme","_id":"@danielcobo/uniqueselector@1.0.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.3","dist":{"integrity":"sha512-XR9XlkFt90JXYLxMeG0LCckLhcsMXtRdSVN76RCSYr2St8NkW093uG3xffL5t2XMPYo9bXgWG8M2Bzs1F3cDKA==","shasum":"9f5884916c1c46ffd9d04e90dff4d34b0e5ceecd","tarball":"https://registry.npmjs.org/@danielcobo/uniqueselector/-/uniqueselector-1.0.0.tgz","fileCount":11,"unpackedSize":17133,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC4hZLw0c/+sr0VbtwQvcsFXALh6R4rSXdaWsfuxlx3CwIhAIiOHFkIReIfaruZwkQQRpYmh2Wv0wq/VXaEXihqqnWi"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLzyQACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqQpw/+M6vlnzKoLk/Z6VWPejkrI8msrBrqlga6jGQJmFuQ/XfoDV59\r\nl4e2TfBw0Y8Eu6tOZGKwsCWKrB3MQwt/BHAh7+DUHcX2FzcpfOAgldI+Zr1A\r\nLjv9dLUrjmWSBgu+UARp7p+UfvY8M6h6GmmC+cNI+m27ny+xm5JyhrRfU5iv\r\nityNDYyblFvBg5ZMljRLxyU3XgtAPFKKype4hiXDV8rspF0JWFE+qh+b0yAV\r\n0eDxEeZ6H5PYW+1rfQ4TqXfzKYB4gWmAaOfJYic5Ed0zYOv84cJVtLnEEkBI\r\nYbrH6TVQqOHW8nwlbfF4PDbgA4OqclRXbXBA+nNpbX1QDhNjIm2xU2HyaM59\r\n15BZvCzs2CqhdGd6Ny16h1oCTE8e9fXl6o/qkvpt+o5BNt5nOBqrNlvLJa+Y\r\n5pWc5cJcHphWEFoBULmQtMgsqGbbxt6/q2VD4yG2gYLNzsWJED4/2v9me2t4\r\nzHOBWOEkG4tJ+j9s35GH2gVkVPWlzOQYYBT6f9r69a4oZCSZ7XgKe3xBxvL6\r\nyVgcgDfmAdEIARQuvS1EAIEmqI6NBOZdxHHHhfq7kG4SmxUNA2oDBTzelxS9\r\njC3MCBsHOEXEUFx5N6UgzyUlkrSdn0nQE6GLnFLXPSQR6q5q3KSsHzGi1DJN\r\n4HgNbIacbT/iAw8SnTuObFeMUIzy6+/Vu7Y=\r\n=D6P/\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"danielcobo","email":"npm@tidysource.com"},"directories":{},"maintainers":[{"name":"danielcobo","email":"npm@tidysource.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/uniqueselector_1.0.0_1664040079815_0.6330691351550917"},"_hasShrinkwrap":false},"1.0.1":{"name":"@danielcobo/uniqueselector","version":"1.0.1","description":"Get unique selector for given element","main":"src/index.js","scripts":{"test":"jest --env=jsdom --collectCoverage --runInBand","testing":"jest --watch --collectCoverage --runInBand","mutation":"npx stryker run","docs":"docs","patch":"git push && npm version patch && npm publish","minor":"git push && npm version minor && npm publish","major":"git push && npm version major && npm publish","rollup":"rollup -c","prepublishOnly":"rollup -c"},"repository":{"type":"git","url":"git+https://github.com/danielcobo/uniqueselector.git"},"author":{"name":"Daniel Cobo","url":"https://danielcobo.com/"},"license":"MIT","devDependencies":{"@danielcobo/docs":"^1.0.16","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@stryker-mutator/core":"^5.4.1","@stryker-mutator/jest-runner":"^5.4.1","jest":"^27.2.5","rollup":"^2.56.3","rollup-plugin-terser":"^7.0.2"},"dependencies":{"@danielcobo/rmtrailing":"^1.0.7"},"gitHead":"5043241037c26e2f33d782a6ee12be4b4422fb98","bugs":{"url":"https://github.com/danielcobo/uniqueselector/issues"},"homepage":"https://github.com/danielcobo/uniqueselector#readme","_id":"@danielcobo/uniqueselector@1.0.1","_nodeVersion":"16.13.0","_npmVersion":"8.1.3","dist":{"integrity":"sha512-tmHny24g9l2Pt5bBjAlNAR3L1Cq2EkjKjm32evqto+VPoEvPQzEe5cnxunwz3ud/pCyEzwuqGxdS0n0MIPKtqw==","shasum":"6f84e748a51487576a92aa23c80dd1c42bad38d8","tarball":"https://registry.npmjs.org/@danielcobo/uniqueselector/-/uniqueselector-1.0.1.tgz","fileCount":11,"unpackedSize":17079,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAIYdKn8y+Ezpx/oRtM5ZsjxeDjnM2TYYdUIE9whgI0aAiAg00bMsTH97dzV9bjCtX6mee0hTAbMs1y8dke3MtrHUA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLz0aACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpOpRAAgDevA9lGRteuZBzmCs+trtuSRRLwBZgm3fQS56lja5wu0DHb\r\nqyNqD1BDWMtPLtzVgEC6UdNyc4/f+j2UW+AAIWiijNt87TDCqlwNMDfjGfbd\r\n7TxYkln18X1LplMjpXrWiZwG3+GlFZF9N1GiuUIN30O+TqtkAndX4S44EXBP\r\nVWpyMpjxJL+AyuaFH15DLj5NgOeG9/IDBYbwd+ESP7U1pTkQxjP+dauUNYXi\r\n6piMUHDJwlF7OgBvIl4oQFktXBFWLJ4rH+hPpWNbA1YY3YKjbWW1C9LGUiYX\r\nIlezkp7jahlVVg2aqLfO4xxPU/bHCkUndkcFGWZotcitMwEKuvBjzsOZJKnC\r\nV/hZQH4uiTshzzIS1CBDvg60uSMBOCZ6S/MRxfsxSka0UDhbDh/EkwiMNjUr\r\ncwQfMeWg1AaOWJRXdb8ZuIJtnX+UOWwJL80WvQKGdYWNDtKbp4omVjCRJmbq\r\niArVrJxx+GYJ3c+9MVALg94gbGp6bEb7BbYLVrg9WiD14xJs5cwpvGWi0Kup\r\ngXfZcGWuGm9WS+dvH1Dyo1qRTFdOrgjsHK5FDfHkD+k9mxrMPKpcVkDz9v0N\r\nX9utvEQRplYaXYZKhSPf4dANLWWLdW+A7xCuCJpqszJIyK9FbII9IhAyMVNQ\r\neovTNX3hNxWeDpaRh8nTuCAx/A+g7WzHD5Q=\r\n=7/zG\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"danielcobo","email":"npm@tidysource.com"},"directories":{},"maintainers":[{"name":"danielcobo","email":"npm@tidysource.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/uniqueselector_1.0.1_1664040218204_0.42591950980285254"},"_hasShrinkwrap":false},"1.0.2":{"name":"@danielcobo/uniqueselector","version":"1.0.2","description":"Get unique selector for given element","main":"src/index.js","scripts":{"test":"jest --env=jsdom --collectCoverage --runInBand","testing":"jest --watch --collectCoverage --runInBand","mutation":"npx stryker run","docs":"docs","patch":"git push && npm version patch && npm publish","minor":"git push && npm version minor && npm publish","major":"git push && npm version major && npm publish","rollup":"rollup -c","prepublishOnly":"rollup -c"},"repository":{"type":"git","url":"git+https://github.com/danielcobo/uniqueselector.git"},"author":{"name":"Daniel Cobo","url":"https://danielcobo.com/"},"license":"MIT","devDependencies":{"@danielcobo/docs":"^1.0.16","@rollup/plugin-commonjs":"^20.0.0","@rollup/plugin-node-resolve":"^13.0.4","@stryker-mutator/core":"^5.4.1","@stryker-mutator/jest-runner":"^5.4.1","jest":"^27.2.5","rollup":"^2.56.3","rollup-plugin-terser":"^7.0.2"},"dependencies":{"@danielcobo/rmtrailing":"^1.0.7"},"gitHead":"391248009c94e339a7fb6b67084341c19d95b2c6","bugs":{"url":"https://github.com/danielcobo/uniqueselector/issues"},"homepage":"https://github.com/danielcobo/uniqueselector#readme","_id":"@danielcobo/uniqueselector@1.0.2","_nodeVersion":"16.13.0","_npmVersion":"8.1.3","dist":{"integrity":"sha512-OPWli2uf2v09YKLmDUd9q9oBitEEy5qH6l2BhrIJIEzQGX8pYyXG8nG3zBH16Y/QTHoBaYHBarZ0zl/nwAGj1A==","shasum":"e76904b33e76e3e52ab57b8ba6bf7e677ed92594","tarball":"https://registry.npmjs.org/@danielcobo/uniqueselector/-/uniqueselector-1.0.2.tgz","fileCount":11,"unpackedSize":17073,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC6scstm8c8Vun0vNjwtE3vFyZznihcSrcwM/9551CLqQIhAI+0HkOujuoFZTZrPQwCD8xkF+Roasz5ChTypeO4SAmS"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLz0+ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmozdQ/+J+o2wuTN8UaWUKjXkBsTdpe8gYz3y4BhzTrzuE+AMAe+PPTB\r\nq9obpWcu5yyeyW/4BeBClD6qIr6jz4e/lyymIInGHTXpw5CenHSD1JyicHwU\r\nmEjWw3SR/ZuNKw6vi0xOKmERZM3StlcQxKQKwe+NWn371r1uN85OknAKx8ee\r\nbmO9at+dKMv11Pi/oN6648qshxH3vtP0gCbw3lJDWx/XYYWNEA7yhIJUofl1\r\naF8yxF/e8Uyq+9cvzuetL8DYTzyv25l8Au06DJa1ozlc2nPRdOUo7hNDcmpH\r\ntQFseUNxFY6ZT5ua5XadJbJ7Adaz7x0QPbMn3MEc/jesKcI8KmhEGfSvlSoK\r\nTFLIYr8Nx9XR9EwJlSi9YzHFtiK5yu189/KYEhoaNTjedxZ4oKCYpQGGxxNE\r\nvUp2I0HI7bBpmUNfqEqz/v6sh0bBSViFEb8OxRfNs9anyfRt7BK1qsiXYIrQ\r\nYSOxiXOruHMdF+42aVoVosZ1bRd0/ZQLJkimOr/QJyWHoDE5bUgw+qjFxXDE\r\n4sosuY3bFk59MXl+BPEqtCpIXwfkebT1ctWQFDD1e2K//mCn/X70Tn02/pfZ\r\nw/CCA5L73Ok6vPDUwKdKLr0d3GdaNtPLphXbE8MPT0LEc4PmBhCWCfc12eHt\r\nfM8yz/c/YtqyLvUOYEBt1xT3hOffM8X5Wuw=\r\n=uU/1\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"danielcobo","email":"npm@tidysource.com"},"directories":{},"maintainers":[{"name":"danielcobo","email":"npm@tidysource.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/uniqueselector_1.0.2_1664040254292_0.21995045098403"},"_hasShrinkwrap":false}},"time":{"created":"2022-09-24T17:21:19.747Z","1.0.0":"2022-09-24T17:21:20.041Z","modified":"2022-09-24T17:24:14.524Z","1.0.1":"2022-09-24T17:23:38.361Z","1.0.2":"2022-09-24T17:24:14.448Z"},"maintainers":[{"name":"danielcobo","email":"npm@tidysource.com"}],"description":"Get unique selector for given element","homepage":"https://github.com/danielcobo/uniqueselector#readme","repository":{"type":"git","url":"git+https://github.com/danielcobo/uniqueselector.git"},"author":{"name":"Daniel Cobo","url":"https://danielcobo.com/"},"bugs":{"url":"https://github.com/danielcobo/uniqueselector/issues"},"license":"MIT","readme":"# uniqueselector\n\nGet unique selector for given element\n\n## 🧭 Table of contents\n\n- [✨ Benefits](#-benefits)\n- [🎒 Requierments](#-requierments)\n- [🚀 Quickstart](#-quickstart)\n- [📘 Documentation](#-documentation)\n- [🆘 Troubleshooting](#-troubleshooting)\n- [🤝 Contributing](#-contributing)\n- [🧪 Testing](#-testing)\n- [⚖️ License](#️-license)\n\n## ✨ Benefits\n\n- [x] Tiny size\n- [x] Uses id when possible\n- [x] Fallback to nth-child position\n\n## 🎒 Requierments\n\nNo requierments.\n\n## 🚀 Quickstart\n\n### Install\n\n#### NodeJS\n\nInstall using the terminal:\n\n```cli\nnpm install @danielcobo/uniqueselector\n```\n\nRequire the module:\n\n```js\nconst uniqueselector = require('@danielcobo/uniqueselector');\n```\n\n<sub>**Note:** In case you're wondering, **@danielcobo/** is just a [namespace scope](https://docs.npmjs.com/about-scopes/) - an NPM feature. Scopes make it easier to name modules and improve [security](https://github.blog/2021-02-12-avoiding-npm-substitution-attacks/).</sub>\n\n#### Browser\n\nDeclare it as a global variable named uniqueselector by including this script before any script you want to use it in:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/@danielcobo/uniqueselector@1/dist/iife/uniqueselector.min.js\"></script>\n```\n\nOr import it as an [ECMAScript module](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import):\n\n```js\nimport * as uniqueselector from 'https://cdn.jsdelivr.net/npm/@danielcobo/uniqueselector@1/dist/esm/uniqueselector.min.js';\n```\n\nAlso, feel free to download the file if you prefer not to use [jsdelivr](https://www.jsdelivr.com). In that case just replace the url with the relative file path.\n\n### Example use\n\n```js\ndocument.body.innerHTML = '';\nconst div = document.createElement('div');\ndiv.id = 'test';\nconst div2 = document.createElement('div');\ndiv2.id = 'test2';\ndocument.body.appendChild(div);\ndiv.appendChild(div2);\n\nuniqueSelector(div, { id: false }) //'div:nth-child(1)'\nuniqueSelector(div2) //'#test2'\n```\n\nFor details see documentation below.\n\n## 📘 Documentation\n### uniqueselector()\nGet unique selector for element\n\n| Name | Type | Default | Description |\n| ---- | ---- | ------- | ----------- |\n| $el | `HTML element` |  |  |\n| [options.id] | `undefined`|`boolean` | true |  |\n\n#### Returns\n| Type | Description |\n| ---- | ----------- |\n| `string` | Selector |\n\n<sub>**Source:** [src/index.js:5](https://github.com/danielcobo/uniqueselector/blob/master/src/index.js?plain=1#L5)</sub>\n\n## 🆘 Troubleshooting\n\nIf you run into trouble or have questions just [submit an issue](https://github.com/danielcobo/uniqueselector/issues).\n\n## 🤝 Contributing\n\n### Anyone can contribute\n\nContributions come in many shapes and sizes. All are welcome.\nYou can contribute by:\n\n- asking questions\n- suggesting features\n- sharing this repo with friends\n- improving documentation (even fixing typos counts 😉)\n- providing tutorials (if you do, please [let me know](https://twitter.com/danielcobocom), I would love to read them)\n- improving tests\n- contributing code (new features, performance boosts, code readability improvements..)\n\n### Rules for contributions\n\n**General guidelines:**\n\n- there are no dumb questions\n- be polite and respectful to others\n- do good\n\n**When coding remember:**\n\n- working > maintainability > performance\n- best code is no code\n- be descriptive when naming\n- keep it [DRY](https://en.wikipedia.org/wiki/Don%27t_repeat_yourself)\n- do test\n\n**Contribution licence:**\nAll contributions are considered to be under same [license](#️-license) as this repository.\n\n## 🧪 Testing\n\n**Testing suite:** [🃏 Jest](https://jestjs.io) | **Test command:** `npm test`\n\n**Mutation testing suite:** [👽 Stryker Mutator](https://stryker-mutator.io) | **Mutation test command:** `npm run mutation`\n\nIf you intend to develop further or contribute code, then please ensure to write and use testing. Strive for 100% code coverage and high mutation scores. Mutation score 100 is great, but it's not always neccessary (if there are valid reasons).\n\n## ⚖️ License\n\n[MIT License](https://github.com/danielcobo/uniqueselector/blob/master/LICENSE.md)","readmeFilename":"README.md"}