{"name":"rotated-array-set","version":"1.0.0","description":"Set of (possibly rotated) arrays","author":{"name":"Gustaf Räntilä"},"license":"MIT","bugs":{"url":"https://github.com/grantila/rotated-array-set/issues"},"homepage":"https://github.com/grantila/rotated-array-set#readme","main":"./dist/index.js","types":"./dist/index.d.ts","directories":{},"engines":{"node":">=12"},"scripts":{"build":"rimraf dist && tsc -p tsconfig.prod.json","test":"jest --coverage","cz":"git-cz"},"repository":{"type":"git","url":"git+https://github.com/grantila/rotated-array-set.git"},"keywords":["set","rotated","array","arrays"],"devDependencies":{"@types/jest":"^26.0.20","@types/node":"^14.14.31","cz-conventional-changelog":"^3.1.0","jest":"^26.6.3","rimraf":"^3.0.1","ts-jest":"^26.5.2","typescript":"^4.2.2"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"gitHead":"bff8ab8d7354b01985d074fda11ece45bf6041d0","_id":"rotated-array-set@1.0.0","_nodeVersion":"14.16.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-MmMz9ERrZw7DVn8e6V7U/wkAWzEaULiPySEBXLWh4nA/F5gwSFx96bu+As4wyDpZ9bdhc+flB1CyTYmStwZo8A==","shasum":"e6d6e2c52465923ec6c1bb5a6af193c31d04f0eb","tarball":"http://registry-npm.ywwl.com/rotated-array-set/download/rotated-array-set-1.0.0.tgz","fileCount":5,"unpackedSize":8569,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgZjisCRA9TVsSAnZWagAAr5oP/jmvuIYoXWa3QP9hr8cj\nDg3sACgAZgjJojQ7ebAzZnYxTYYerXuUCOoGVVkWCOoQdmLafcHSNRqIt6Vg\n1keukh1WlIsLzw8787H9BjUhExNgsGscQcVuDtV8E9oJVbKgvP1EHui4emjP\n/0MYSxVsoK8GLp0C4IzqAzISOy4HQ1BQX/2Ubw6No/+G+heMyuGKgi4+6VfW\nzOUaskettCrL3nCfvUiMUz76qpTn/2FRItI9IK09TKcsfMrBxAEbCGEPswZv\ncXbxfaWNM2sOMitIINkbxkmSuZbrEHyqvzWcQrWeMjM/39B1VOyn67F20wKu\nI/dak6zPRGeoyu7Bdz+X2DaHyXZJk1CBkSp+18u05UO4PtDsYjknguFZuPp7\nRv/rvqvpyb4QI71ZeAfn49MZWhoyqPexemHt2q/9Mr2/VPQFukwm5IJ8ZmTE\n/LskKcXpR0EukmGiWa4E0sEjspaD2HyBdzEDauBP7J7uznIbDl0Ffw45uMN1\nZbRiMIljqZ/0hf7kAXu9CHKqvRavAqJqrSdDZqHwM1EmpZgxtPQwoXre5ZUM\nEnoIpvH2erDQ6t1MBH77HkU1/ti0+/bDipRP3RdQdb+fV4Hq3GgrQdwGSkTg\nAYO6rhcUoGJJRjlzF6uSAjlQAITesLiLOhVMI9BtUz58NE5ooHSAUCcQMrIn\n83P8\r\n=tMRW\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCiJwGXazJmm9+olghWNY9dyk4mk5OMDZvlurGZIctShAIgNwvDte+caFNa5w2pHDxPTO8v5vWcHU5O+Q9sIBHTTJY="}],"size":3379,"noattachment":false,"key":"/rotated-array-set/-/rotated-array-set-1.0.0.tgz"},"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"maintainers":[{"name":"grantila","email":"g.rantila@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rotated-array-set_1.0.0_1617311915851_0.7837373313512173"},"_hasShrinkwrap":false,"readme":"[![npm version][npm-image]][npm-url]\n[![downloads][downloads-image]][npm-url]\n[![build status][build-image]][build-url]\n[![coverage status][coverage-image]][coverage-url]\n[![Node.JS version][node-version]][node-url]\n\n\n# rotated-array-set\n\n`RotatedArraySet` is a class looking a bit like the built-in [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) but is a set of arrays of `T`, and treats rotated arrays as \"same\".\n\n\n# API\n\nConstruct a `RotatedArraySet`, optionally provide a *stringify* method, converting `T` to `string` (this is not necessary for primitive types).\n\n\n## Versions\n\n * Since v2 this is a [pure ESM][pure-esm] package, and requires Node.js >=12.20. It cannot be used from CommonJS.\n * Since v3 requires Node.js >= 14.13.1.\n\n\n## Example\n\n```ts\nimport { RotatedArraySet } from 'rotated-array-set'\n\nconst tree = new RotatedArraySet< string >( );\n\ntree.insert( [ 'a', 'b', 'c' ] );\ntree.insert( [ 'x', 'y' ] );\ntree.insert( [ 'c', 'a', 'b' ] ); // won't insert, already has this but rotated\ntree.insert( [ 'y', 'x' ] ); // won't insert, same reason\n\ntree.has( [ 'b', 'c', 'a' ] ); // true\ntree.has( [ 'c', 'b', 'a' ] ); // false - this isn't *rotated*\n\ntree.values( ); // [ [ 'a', 'b', 'c' ], [ 'x', 'y' ] ]\n```\n\nProvide a custom stringifier:\n\n```ts\nimport { RotatedArraySet } from 'rotated-array-set'\n\nconst tree = new RotatedArraySet< User >( user => `${user.first} ${user.last}` );\n\ntree.insert( [ user1, user2, user3 ] );\ntree.insert( [ user3, user1, user2 ] ); // won't insert, already has this but rotated\n\ntree.has( [ user2, user3, user1 ] ); // true\ntree.has( [ user3, user2, user1 ] ); // false - not *rotated*\n\ntree.values( ); // [ [ user1, user2, user3 ] ]\n```\n\n\n[npm-image]: https://img.shields.io/npm/v/rotated-array-set.svg\n[npm-url]: https://npmjs.org/package/rotated-array-set\n[downloads-image]: https://img.shields.io/npm/dm/rotated-array-set.svg\n[build-image]: https://img.shields.io/github/actions/workflow/status/grantila/rotated-array-set/master.yml?branch=master\n[build-url]: https://github.com/grantila/rotated-array-set/actions?query=workflow%3AMaster\n[coverage-image]: https://coveralls.io/repos/github/grantila/rotated-array-set/badge.svg?branch=master\n[coverage-url]: https://coveralls.io/github/grantila/rotated-array-set?branch=master\n[node-version]: https://img.shields.io/node/v/rotated-array-set\n[node-url]: https://nodejs.org/en/\n[pure-esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n","publish_time":1617311915988,"_cnpm_publish_time":1617311915988,"dist-tags":{"latest":"3.0.0"}}