{"name":"fast-unique-numbers","version":"9.0.27","keywords":["performance","speed"],"author":{"name":"Christoph Guttandin"},"license":"MIT","_id":"fast-unique-numbers@9.0.27","maintainers":[{"name":"chrisguttandin","email":"chrisguttandin@media-codings.com"}],"homepage":"https://github.com/chrisguttandin/fast-unique-numbers","bugs":{"url":"https://github.com/chrisguttandin/fast-unique-numbers/issues"},"dist":{"shasum":"df4f60fe6856fb1eafb9f2fa908942bf0ac7b1df","tarball":"http://registry-npm.ywwl.com/fast-unique-numbers/download/fast-unique-numbers-9.0.27.tgz","fileCount":29,"integrity":"sha512-nDA9ADeINN8SA2u2wCtU+siWFTTDqQR37XvgPIDDmboWQeExz7X0mImxuaN+kJddliIqy2FpVRmnvRZ+j8i1/A==","signatures":[{"sig":"MEUCIQDtaSNNejBIBYrENWUSvUwiooXwwFzIKGqF+FkGp0rm4gIgX5RqcCDguE1VAqJ3dmie/iF1flsw9FC/zElmYx5oKro=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26551,"size":6460,"noattachment":false,"key":"/fast-unique-numbers/-/fast-unique-numbers-9.0.27.tgz"},"main":"build/node/module.js","types":"build/es2019/module.d.ts","config":{"commitizen":{"path":"cz-conventional-changelog"}},"module":"build/es2019/module.js","browser":"build/es5/bundle.js","engines":{"node":">=18.2.0"},"gitHead":"f002b47147e8a820041cb97b9b8db6ed06f29813","scripts":{"lint":"npm run lint:config && npm run lint:src && npm run lint:test","test":"npm run lint && npm run build && npm run test:expectation-chrome && npm run test:expectation-firefox && npm run test:expectation-node && npm run test:unit-browser && npm run test:unit-node","build":"rimraf build/* && tsc --project src/tsconfig.json && rollup --config config/rollup/bundle.mjs && babel ./build/es2019 --config-file ./config/babel/build.json --out-dir ./build/node","prepare":"husky","lint:src":"tslint --config config/tslint/src.json --project src/tsconfig.json src/*.ts src/**/*.ts","lint:test":"eslint --config config/eslint/test.json --ext .js --report-unused-disable-directives test/","lint:config":"eslint --config config/eslint/config.json --ext .cjs --ext .js --ext .mjs --report-unused-disable-directives config/","prepublishOnly":"npm run build","test:unit-node":"if [ \"$TYPE\" = \"\" -o \"$TYPE\" = \"unit\" ] && [ \"$TARGET\" = \"\" -o \"$TARGET\" = \"node\" ]; then npx vitest --browser.enabled false --config config/vitest/unit.ts; fi","test:unit-browser":"if [ \"$TYPE\" = \"\" -o \"$TYPE\" = \"unit\" ] && [ \"$TARGET\" = \"\" -o \"$TARGET\" = \"chrome\" -o \"$TARGET\" = \"firefox\" -o \"$TARGET\" = \"safari\" ]; then npx vitest --config config/vitest/unit.ts; fi","test:expectation-node":"if [ \"$TYPE\" = \"\" -o \"$TYPE\" = \"expectation\" ] && [ \"$TARGET\" = \"\" -o \"$TARGET\" = \"node\" ]; then npx vitest --config config/vitest/expectation-node.ts; fi","test:expectation-chrome":"if [ \"$TYPE\" = \"\" -o \"$TYPE\" = \"expectation\" ] && [ \"$TARGET\" = \"\" -o \"$TARGET\" = \"chrome\" ]; then npx vitest --config config/vitest/expectation-chrome-current.ts; fi","test:expectation-firefox":"if [ \"$TYPE\" = \"\" -o \"$TYPE\" = \"expectation\" ] && [ \"$TARGET\" = \"\" -o \"$TARGET\" = \"firefox\" ]; then npx vitest --config config/vitest/expectation-firefox-current.ts; fi"},"_npmUser":{"name":"chrisguttandin","email":"chrisguttandin@media-codings.com"},"repository":{"url":"git+https://github.com/chrisguttandin/fast-unique-numbers.git","type":"git"},"_npmVersion":"8.19.3","description":"A module to create a set of unique numbers as fast as possible.","directories":{},"_nodeVersion":"22.22.0","dependencies":{"tslib":"^2.8.1","@babel/runtime":"^7.29.2"},"_hasShrinkwrap":false,"devDependencies":{"husky":"^9.1.7","eslint":"^8.57.0","rimraf":"^6.1.3","rollup":"^4.59.0","tslint":"^6.1.3","vitest":"^4.1.0","prettier":"^3.8.1","tinybench":"^4.0.1","@babel/cli":"^7.28.6","commitizen":"^4.3.1","typescript":"^5.9.3","@babel/core":"^7.29.0","lint-staged":"^16.4.0","@commitlint/cli":"^20.5.0","@babel/preset-env":"^7.29.2","tsconfig-holy-grail":"^15.0.3","@rollup/plugin-babel":"^7.0.0","eslint-config-holy-grail":"^61.0.11","tslint-config-holy-grail":"^56.0.7","cz-conventional-changelog":"^3.3.0","@commitlint/config-angular":"^20.5.0","@vitest/browser-webdriverio":"^4.1.0","@babel/plugin-external-helpers":"^7.27.1","@babel/plugin-transform-runtime":"^7.29.0"},"_npmOperationalInternal":{"tmp":"tmp/fast-unique-numbers_9.0.27_1773709719423_0.22276326197060903","host":"s3://npm-registry-packages-npm-production"},"readme":"# fast-unique-numbers\n\n**A module to create a set of unique numbers as fast as possible.**\n\n[![version](https://img.shields.io/npm/v/fast-unique-numbers.svg?style=flat-square)](https://www.npmjs.com/package/fast-unique-numbers)\n\nThis module is meant to create unique numbers within a given [Map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) or [Set](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set). To achieve that as fast as possible the resulting set of numbers will only contain integers. Additionally only small integers will be used for as long as possible. Small integers can be stored more efficiently by JavaScript engines like [SpiderMonkey](https://spidermonkey.dev/) or [V8](https://v8.dev).\n\nTo verify the expected perfomance benefit an expectation test is used to make sure small integers do actually perform better in Chromium based browsers, Firefox and when using Node.js.\n\n## Usage\n\nThis module is available on [npm](https://www.npmjs.com/package/fast-unique-numbers) and can be\ninstalled by running the following command:\n\n```shell\nnpm install fast-unique-numbers\n```\n\nThis module exports two functions.\n\n### addUniqueNumber()\n\nThis function takes a `Set` of numbers as argument and appends a new unique number to it. It also returns that number.\n\n```js\nimport { addUniqueNumber } from 'fast-unique-numbers';\n\nconst set = new Set([1, 4, 8]);\nconst uniqueNumber = addUniqueNumber(set);\n\nconsole.log(uniqueNumber); // 3\nconsole.log(set); // Set(4) { 1, 4, 8, 3 }\n```\n\n### generateUniqueNumber()\n\nThis function can be used to generate a unique number which is not yet present in the given `Set` or is no key in the given `Map`. The resulting number gets not appended. It only gets returned.\n\n```js\nimport { generateUniqueNumber } from 'fast-unique-numbers';\n\nconst map = new Map([\n    [1, 'something'],\n    [4, 'something else']\n]);\n\nconst uniqueNumber = generateUniqueNumber(map);\n\nconsole.log(uniqueNumber); // 2\n```\n\n## Security contact information\n\nTo report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.\n","publish_time":1773709719576,"_cnpm_publish_time":1773709719576,"dist-tags":{"latest":"10.0.1"}}