{"_id":"rotated-array-set","_rev":"3290763","name":"rotated-array-set","description":"Set of (possibly rotated) arrays","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"grantila","email":""}],"time":{"modified":"2024-05-23T06:50:41.000Z","created":"2021-04-01T21:18:35.988Z","3.0.0":"2023-02-02T20:56:30.663Z","2.0.0":"2021-09-13T06:49:24.789Z","1.0.0":"2021-04-01T21:18:35.988Z"},"users":{},"author":{"name":"Gustaf Räntilä"},"repository":{"type":"git","url":"git+https://github.com/grantila/rotated-array-set.git"},"versions":{"3.0.0":{"name":"rotated-array-set","version":"3.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","exports":"./dist/index.js","types":"./dist/index.d.ts","type":"module","sideEffects":false,"engines":{"node":"^14.13.1 || >=16.0.0"},"scripts":{"build":"rimraf dist && tsc -p tsconfig.prod.json","test":"NODE_OPTIONS=--experimental-vm-modules jest --coverage","cz":"git-cz"},"repository":{"type":"git","url":"git+https://github.com/grantila/rotated-array-set.git"},"keywords":["set","rotated","array","arrays"],"devDependencies":{"@babel/preset-env":"^7.20.2","@babel/preset-typescript":"^7.18.6","@types/jest":"^29.4.0","@types/node":"^18.11.18","cz-conventional-changelog":"^3.3.0","jest":"^29.4.1","rimraf":"^4.1.2","typescript":"^4.9.5"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"jest":{"testEnvironment":"node","coverageReporters":["lcov","text","html"]},"packageManager":"yarn@3.2.4","gitHead":"90d3ac88bc7648d2cf63d257d9772ab496c4071e","_id":"rotated-array-set@3.0.0","_nodeVersion":"18.13.0","_npmVersion":"8.19.3","dist":{"shasum":"47210ae6aaa9a8abacf2ec959884d31353559dfd","size":3456,"noattachment":false,"key":"/rotated-array-set/-/rotated-array-set-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rotated-array-set/download/rotated-array-set-3.0.0.tgz"},"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"directories":{},"maintainers":[{"name":"grantila","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rotated-array-set_3.0.0_1675371390438_0.509112671806699"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-02-02T20:56:30.663Z","publish_time":1675371390663,"_cnpm_publish_time":1675371390663},"2.0.0":{"name":"rotated-array-set","version":"2.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","exports":"./dist/index.js","types":"./dist/index.d.ts","type":"module","sideEffects":false,"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"scripts":{"build":"rimraf dist && tsc -p tsconfig.prod.json","test":"NODE_OPTIONS=--experimental-vm-modules jest --coverage","cz":"git-cz"},"repository":{"type":"git","url":"git+https://github.com/grantila/rotated-array-set.git"},"keywords":["set","rotated","array","arrays"],"devDependencies":{"@babel/preset-env":"^7.15.6","@babel/preset-typescript":"^7.15.0","@types/jest":"^27.0.1","@types/node":"^16.9.1","cz-conventional-changelog":"^3.1.0","jest":"^27.1.1","rimraf":"^3.0.1","typescript":"^4.4.3"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}},"jest":{"testEnvironment":"node","coverageReporters":["lcov","text","html"]},"gitHead":"81931d4bea76d76f37606c968a8dc11abeff71ca","_id":"rotated-array-set@2.0.0","_nodeVersion":"14.17.6","_npmVersion":"6.14.15","dist":{"shasum":"36495a61ea12e2447376c69be6d412b4de1ed00a","size":3538,"noattachment":false,"key":"/rotated-array-set/-/rotated-array-set-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rotated-array-set/download/rotated-array-set-2.0.0.tgz"},"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"directories":{},"maintainers":[{"name":"grantila","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rotated-array-set_2.0.0_1631515764671_0.7189227506771809"},"_hasShrinkwrap":false,"publish_time":1631515764789,"_cnpm_publish_time":1631515764789,"_cnpmcore_publish_time":"2021-12-17T00:21:37.625Z"},"1.0.0":{"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":{"shasum":"e6d6e2c52465923ec6c1bb5a6af193c31d04f0eb","size":3379,"noattachment":false,"key":"/rotated-array-set/-/rotated-array-set-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/rotated-array-set/download/rotated-array-set-1.0.0.tgz"},"_npmUser":{"name":"grantila","email":"g.rantila@gmail.com"},"maintainers":[{"name":"grantila","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/rotated-array-set_1.0.0_1617311915851_0.7837373313512173"},"_hasShrinkwrap":false,"publish_time":1617311915988,"_cnpm_publish_time":1617311915988,"_cnpmcore_publish_time":"2021-12-17T00:21:37.861Z"}},"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","_attachments":{},"homepage":"https://github.com/grantila/rotated-array-set#readme","bugs":{"url":"https://github.com/grantila/rotated-array-set/issues"},"license":"MIT"}