{"_id":"uid","_rev":"24-7ef58f2a6c4bd338620679223cab1ee4","name":"uid","description":"A tiny (130B to 205B) and fast utility to randomize unique IDs of fixed length","dist-tags":{"latest":"2.0.2"},"versions":{"0.0.1":{"name":"uid","version":"0.0.1","description":"generate unique ids of variable length","main":"yes","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git://github.com/MatthewMueller/uid.git"},"keywords":["unique","id","uid"],"author":{"name":"Matthew Mueller"},"license":"MIT","_id":"uid@0.0.1","dist":{"shasum":"bc1f86c72fb7385d1acc9d71fcf2d811e947c5e9","tarball":"https://registry.npmjs.org/uid/-/uid-0.0.1.tgz","integrity":"sha512-qeNlaADWZAsMwIhBpxT6FcpIrXBsg7stBT9MFnEqrlqT8/HeS9XGfhJq0T3cQnvYkKgGhFi9wYyvSBm7YmV/JA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCfqlRAv6RuGoIDOMQ+vqkmSwZA3Fd2oF/we2jfXmXT+QIgG+gSdT9RJit0Z7F8E3zN9jDcsyA0UULshtXyuj4H6UA="}]},"_npmVersion":"1.1.65","_npmUser":{"name":"mattmueller","email":"mattmuelle@gmail.com"},"maintainers":[{"name":"mattmueller","email":"mattmuelle@gmail.com"}],"directories":{}},"0.0.2":{"name":"uid","version":"0.0.2","description":"generate unique ids of variable length","main":"yes","repository":{"type":"git","url":"git://github.com/MatthewMueller/uid.git"},"keywords":["unique","id","uid"],"bin":{"uid":"./bin/uid"},"author":{"name":"Matthew Mueller"},"license":"MIT","_id":"uid@0.0.2","dist":{"shasum":"5e4a5d4b78138b4f70f89fd3c76fc59aa9d2f103","tarball":"https://registry.npmjs.org/uid/-/uid-0.0.2.tgz","integrity":"sha512-KerEqWSoUfzAYsB4RznGPygtEk1p04caicg8FxqzZ1VYI3GsYHPzouUO5jJvwwy4sg6B1jnSkSjYgGvE4CK6Gg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAz7DWygDmRi8qROWWRPxk7aM9gFbvZHvW2/3WoLTsgEAiEAm60ODjVX11vDCxhdYrExcLEWVnCdkkni33At+XLi36Q="}]},"_npmVersion":"1.1.71","_npmUser":{"name":"mattmueller","email":"mattmuelle@gmail.com"},"maintainers":[{"name":"mattmueller","email":"mattmuelle@gmail.com"}],"directories":{}},"1.0.0":{"name":"uid","version":"1.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/uid.git"},"description":"A tiny (134B) and fast utility to randomize unique IDs of fixed length","unpkg":"dist/index.min.js","module":"dist/index.mjs","main":"dist/index.js","types":"uid.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=8"},"scripts":{"build":"bundt","pretest":"npm run build","test":"tape -r esm test/*.js | tap-spec"},"keywords":["id","uid","uuid","random","generate","foid"],"devDependencies":{"bundt":"1.0.0","esm":"3.2.25","tap-spec":"5.0.0","tape":"4.9.1"},"gitHead":"60644ddad9d7ed0484b8332d711fad99b52c1588","bugs":{"url":"https://github.com/lukeed/uid/issues"},"homepage":"https://github.com/lukeed/uid#readme","_id":"uid@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"integrity":"sha512-DYp36HDIRECMW0xmeyGSDSheURMbL7gy4DqINDUW5OSw7cot0pNRNvEtEji9nk1XVDZN/0lJ7myxacoTeU9oow==","shasum":"40a64108ebdf765b3945c286b77c83c168687170","tarball":"https://registry.npmjs.org/uid/-/uid-1.0.0.tgz","fileCount":7,"unpackedSize":6828,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeYA1oCRA9TVsSAnZWagAAtlcQAJBCF6NOypFK1w0sZkUl\nIiHkMJdsqaYjj+JuSDUANVx2drdHOHhBv9WCuGkRzaBEzu62naZrUJeOSNll\neuJYAiHRwpSHj/duQL59PTbOcTo+IuM2e2X5AwKaos2VxlQEVUOEz8kREpZ4\ncTcZH64lPUg/V8J68KSdReIC2gJ0Udc71OvIueotg9bb3SYbJhldVU94D+fV\nAtEF0LHg7tuOhLC1sJe3bkNltnAqyzC4+nPDTXGqjh8pUG6rwStANRHVZQTF\n6NjL+TvTC3xoGXs6r3varvrzjFaQwu01Lns8LupB7LKUJAd0pnaLv5sgWemk\n4xhQho0UrbMRK53DCRaznApHgY6OslqEPVi+STnPAOrlKJnYPiVTl+6sa0C8\n4GcbIbmBbTCl+SSeOgzajmG/Bdm+ORPoNaGkV76qe/3+8CNhqo29ACwnLYMH\nLGxJiG5zNPwVTY0xI7p7z6oj/NcmKUPHWMJ0u+XsIdJ12sByCUWqpay25h8C\n92r23RvFCR6skooT2thqtQQSb+5V9d8OdR3j9HdU3k9EgLCxUIKUDlpw5zb4\nmm35Vh1TCNeorc50mFobY7gw8Y49k45V1lXOkA0NZi5oi8W+8kiIOTCWKiKk\nR8IlTGNnXRLoBGsset0K9sn8GsYhY0C3MA6MNobhdp5TMWXSSGY8lkVDU1Hf\nNQ8F\r\n=1mho\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNqYi48BiCs3R8FzaiKBACxN4N6EprdpD3kiMK0aENqAIhAPmxzsjanU6akkRSbj7EDJsSxWIbOQNR7ggOl4loGP2b"}]},"maintainers":[{"email":"luke@lukeed.com","name":"lukeed"},{"email":"mattmuelle@gmail.com","name":"mattmueller"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/uid_1.0.0_1583353191874_0.3992643999208634"},"_hasShrinkwrap":false},"2.0.0":{"name":"uid","version":"2.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/uid.git"},"description":"A tiny (130B to 205B) and fast utility to randomize unique IDs of fixed length","unpkg":"dist/index.min.js","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=8"},"scripts":{"build":"bundt","test":"uvu -r esm test -i collisions"},"exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./single":{"import":"./single/index.mjs","require":"./single/index.js"},"./secure":{"import":"./secure/index.mjs","require":"./secure/index.js"},"./package.json":"./package.json"},"keywords":["id","uid","uuid","random","generate","secure","crypto","foid"],"modes":{"secure":"src/secure.js","default":"src/index.js","single":"src/single.js"},"dependencies":{"@lukeed/csprng":"^1.0.0"},"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.4"},"gitHead":"f1ab26c82670d10931144904abb1b59f8483650f","bugs":{"url":"https://github.com/lukeed/uid/issues"},"homepage":"https://github.com/lukeed/uid#readme","_id":"uid@2.0.0","_nodeVersion":"12.18.4","_npmVersion":"6.14.6","dist":{"integrity":"sha512-hFw+zKBA1szYdbZWj6FjTxZzJnKNf+wTDcsxlJaXS64MCy9LQEmJUVieGYHCKek/WRyFIcs0cEXtGIQmfvHe2A==","shasum":"1773bec106e96955f1658f20272e2ccea414e8bc","tarball":"https://registry.npmjs.org/uid/-/uid-2.0.0.tgz","fileCount":15,"unpackedSize":14605,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfmvZqCRA9TVsSAnZWagAAlmsQAJYhfXvmnwL7L1ZPs4lQ\n5/ZtbpOZwfRuwM1GYjSsOlZum1FXkiLICR8cyWTfU0N6sb6kkkZ/Wx1JIAWv\n6fTat3KRWGY5++gEIvvzXNqTPAhJVHqoeIfoivywz/HhLD5Hsh9axpUJUKMc\n7iwAPtXvCtXG9LNj36BbZr5tXM3HK6B1d+cXgf6eHgJArkKygURhpehkfAAh\nGz8uDiB+IT0eiQVf/HpNf+WQLN8Y6kZGEMbrFr/U3siIwBx6IlcGtTV3+due\nI+JnOZUrZ4m0h7FugmHkYAEnDGtuR8giEki/FN7XTDmKzmXXF1RoBTD92+2Y\nBbrCdsmZUHJENMBFvACxUz3SgSp35swJiPLHI/YCKTG4q8p6+iqyjLsXmqPM\nOJEk0gNe5fJiJyKX18PheFWbjuZshPQRbiUjAPj2GZJsYyAXuA36Dov0REQQ\niyzvWyzgBYgXMN1SmoxdgLm5WyzLVJFwBL0eN83IPqoT6t0HUZb2n9QMSCN7\ncdxjIW63PqGtEDn3ljNtAk4vo+65EGtPd39T5sabqISEuA1UJBQjjWwzbXNO\nP8CZOJeYmZzRhYYQANTTjBQGglAGbkor3Xd6Xe7i5a4NTxafrb51nTyeDNf4\nnf1W8pdwAJP1dUV0inoCGoNXJKfLM4ML8sicp6IxsVbsPPLkucjG4RtA4hkC\ndi+c\r\n=2wGX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCkP+s6c4+1xXYoHXv9cyqueareO7nEKZYtgmhT5SrkjgIgMsIl6o/XRtGAcfPDUZjQSG/kMqpIP0M7UVNj6ES0g/A="}]},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/uid_2.0.0_1603991146362_0.004967707607460126"},"_hasShrinkwrap":false},"2.0.1":{"name":"uid","version":"2.0.1","repository":{"type":"git","url":"git+https://github.com/lukeed/uid.git"},"description":"A tiny (130B to 205B) and fast utility to randomize unique IDs of fixed length","unpkg":"dist/index.min.js","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=8"},"scripts":{"build":"bundt","test":"uvu -r esm test -i collisions"},"exports":{".":{"types":"./index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./single":{"types":"./single/index.d.ts","import":"./single/index.mjs","require":"./single/index.js"},"./secure":{"types":"./secure/index.d.ts","import":"./secure/index.mjs","require":"./secure/index.js"},"./package.json":"./package.json"},"keywords":["id","uid","uuid","random","generate","secure","crypto","foid"],"modes":{"secure":"src/secure.js","default":"src/index.js","single":"src/single.js"},"dependencies":{"@lukeed/csprng":"^1.0.0"},"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.4"},"gitHead":"421297570d40d6705c3a50a582466018251630c9","bugs":{"url":"https://github.com/lukeed/uid/issues"},"homepage":"https://github.com/lukeed/uid#readme","_id":"uid@2.0.1","_nodeVersion":"18.8.0","_npmVersion":"8.18.0","dist":{"integrity":"sha512-PF+1AnZgycpAIEmNtjxGBVmKbZAQguaa4pBUq6KNaGEcpzZ2klCNZLM34tsjp76maN00TttiiUf6zkIBpJQm2A==","shasum":"a3f57c962828ea65256cd622fc363028cdf4526b","tarball":"https://registry.npmjs.org/uid/-/uid-2.0.1.tgz","fileCount":15,"unpackedSize":14852,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIChrfGsOMY2NtV/2S34BRYKphQWehT0swEWPYkCPOzWfAiBLWg9aYY3xpsPhVgQ1B7LNeZBK/JYS0QgfQaTtrLw+rg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjNb5pACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpPhw/+KrjOd7E7QqIge/T73LY+deOm14u55Bq8eyI5eGcGfLNl9igv\r\ni2osZmDjvkkT5gU0EVnKbIrXaIRC8Dm/0F8c4XdctVkfnywCyK6LSKuZ+GgW\r\nt3k8fp+lWScN8gRp7M9VkKgI6j0FZHpFgGgKEgqh9Ibfzz4TY4v86XrKu/k9\r\nX6IbOa9ScZBfu5EpHDcEGrM7t6y4t0GaQZIY5ZFDwau6vyP2M4DlpLnfogfn\r\noapb9wDVccYiqDpldJi+7uW1Gu0ID22EfDngjPyQR9ON+5LNQ8TAl6GN3FQN\r\nJ4bjLQ3MjZpTWHnbD4amui9FjTxfq0b3Vfti3GDgcdSyI5Ep449V5JS8bhAO\r\nq7KwRlqnaYyJEn0MJEos9X2L6gmFizkVWLazE6mExHCGcOm2DxyelaeJaMQ3\r\nwICC9pmOXMzgXVkMDJy7biCfirTQBG/FyQgdlCGVMrvf4oM6hUbkOccW4J9H\r\nkeilA2aX2kmnMOgDtDwBlJPD1ZHhknN50d3QLrMCwbAgaOvo8x82Xv5KSPcy\r\n6U+0pCbuTDsiZiMOaQsFStivMl/qnenjiTnXPhASX82tjYiq4Pu3iXX1oRxY\r\nuxK9iBSus3GZcSbKOHoc7STOSlKAJWKMK0fHBgP9+pAODFY2pvys4SYhCCBW\r\nzNug9yT80IMAj8DCERyy+fUjLUACOkEaMqE=\r\n=UC8W\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/uid_2.0.1_1664466537504_0.13522333625768113"},"_hasShrinkwrap":false},"2.0.2":{"name":"uid","version":"2.0.2","repository":{"type":"git","url":"git+https://github.com/lukeed/uid.git"},"description":"A tiny (130B to 205B) and fast utility to randomize unique IDs of fixed length","unpkg":"dist/index.min.js","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=8"},"scripts":{"build":"bundt","test":"uvu -r esm test -i collisions"},"exports":{".":{"types":"./index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./single":{"types":"./single/index.d.ts","import":"./single/index.mjs","require":"./single/index.js"},"./secure":{"types":"./secure/index.d.ts","import":"./secure/index.mjs","require":"./secure/index.js"},"./package.json":"./package.json"},"keywords":["id","uid","uuid","random","generate","secure","crypto","foid"],"modes":{"secure":"src/secure.js","default":"src/index.js","single":"src/single.js"},"dependencies":{"@lukeed/csprng":"^1.0.0"},"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.4"},"gitHead":"5c4971b04f038c195b2cab09f77242868bd05e67","bugs":{"url":"https://github.com/lukeed/uid/issues"},"homepage":"https://github.com/lukeed/uid#readme","_id":"uid@2.0.2","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"integrity":"sha512-u3xV3X7uzvi5b1MncmZo3i2Aw222Zk1keqLA1YkHldREkAhAqi65wuPfe7lHx8H/Wzy+8CE7S7uS3jekIM5s8g==","shasum":"4b5782abf0f2feeefc00fa88006b2b3b7af3e3b9","tarball":"https://registry.npmjs.org/uid/-/uid-2.0.2.tgz","fileCount":15,"unpackedSize":15467,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDQm+hbZqVkdPSjEuX/mGJSD2ZLFJd6kBWZzFc1FtxLhgIhAMLVFyNOd6Jvmut+vgjHDqwkmtjQyt6U3nPSxgD+nqhi"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkJ0LGACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmraMRAAiU1hmLRQYOOTj8c65nOHsBwd4SyKCIo9PD5guTZSXE1SB2Mr\r\nb3iFpIvXXmrKsQ1xtPB9cX1mHTuyciPBuPn+58OozHpBRmugEz0dFDWyqBi1\r\nOTaggD+rSwj4RIZhTvbw5EqI4IIYD6MFVrFbQlmWJp5lS6cMSpxVb0c/dco/\r\nUJgGSJ+FXzflVGMOLXFSW9+OH3TcqynPyGaboHnPTkMLxeA5LmCoz3pdOKeG\r\nZZF8U5gjParrYRtxUtEdklza3cvDe/geMVcznkBBAZZbaDWhtHQ85qiKSFng\r\nZTVjRmx3vrlB2WjznfpeF7FxYd55PJyoxgfuu/vEEcmrcvtnPnZHLAyNpW4U\r\n9Am8UIjS7EaQpxHimD/S/ccp9v4OPmt5lGFlQvlZwCwgHfBn1DIS7R2Hz89L\r\n21JQglu1xEb30YUkhVzLT7tr9dXM/fmJTplOcr8L4mM+q9+mpf7djTy5jreF\r\n/MyIO1mMg1F5CwqN1dAb55ysF5T0uFybzVHnnhSlJS/S1lDskYXDcUL9TxJe\r\niI9x6ESDYct9j9MtHoeUpnbuabkhLPu58DymdXE99rELP6h1UPOyXJ3iEZuz\r\nhPMTeRxBHVzlZOp5O7Im709WpHYLeoTD1IzQ42DyLElyc4JZ3myl4nnO6xv+\r\noe4ItKxhSXg4wOV5TjJX8cbIpPKtlWk4Tuk=\r\n=MqIn\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/uid_2.0.2_1680294598169_0.6272281070313703"},"_hasShrinkwrap":false}},"readme":"# uid [![CI](https://github.com/lukeed/uid/workflows/CI/badge.svg)](https://github.com/lukeed/uid/actions) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/uid)](https://codecov.io/gh/lukeed/uid)\n\n> A tiny (130B to 205B) and [fast](#benchmarks) utility to randomize unique IDs of fixed length\n\n_**Fast object IDs.** Available for Node.js and the browser._<br>Generate **randomized** output strings of fixed length using lowercase alphanumeric characters (`a-z0-9`). To produce IDs in UUID.V4 format, please see [`@lukeed/uuid`](https://github.com/lukeed/uuid).\n\nThis module offers multiple [modes](#modes) for your needs:\n\n* [`uid`](#uid)<br>_The default is \"non-secure\", which uses `Math.random` to produce UUIDs._\n* [`uid/secure`](#uidsecure)<br>_The \"secure\" mode produces cryptographically secure (CSPRNG) UUIDs using the current environment's `crypto` module._\n* [`uid/single`](#uidsingle)<br>_The \"single\" mode does not maintain an internal cache, which makes it ideal for short-lived environments._\n\nAdditionally, this module is preconfigured for native ESM support in Node.js with fallback to CommonJS. It will also work with any Rollup and webpack configuration, regardless of the \"mode\" selected.\n\n## Install\n\n```\n$ npm install --save uid\n```\n\n## Modes\n\nThere are three \"versions\" of `uid` available:\n\n#### `uid`\n> **Size (gzip):** 174 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/uid/dist/index.js), [ES Module](https://unpkg.com/uid/dist/index.mjs), [UMD](https://unpkg.com/uid/dist/index.min.js)\n\nRelies on `Math.random`, which means that, while faster, this mode **is not** cryptographically secure. <br>Works in Node.js and all browsers. <br>Alphabet: ***Hexadecimal***\n\n#### `uid/secure`\n> **Size (gzip):** 205 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/uid/secure/index.js), [ES Module](https://unpkg.com/uid/secure/index.mjs), [UMD](https://unpkg.com/uid/secure/index.min.js)\n\nRelies on the environment's `crypto` module in order to produce cryptographically secure (CSPRNG) values. <br>Works in all versions of Node.js. Works in all browsers with [`crypto.getRandomValues()` support](https://caniuse.com/#feat=getrandomvalues). <br>Alphabet: ***Hexadecimal***\n\n#### `uid/single`\n> **Size (gzip):** 131 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/uid/single/index.js), [ES Module](https://unpkg.com/uid/single/index.mjs), [UMD](https://unpkg.com/uid/single/index.min.js)\n\nRelies on `Math.random`, which means that this mode **is not** cryptographically secure. <br>Does **not** maintain an internal buffer, which makes this mode ideal for single-use and/or short-lived environments. <br>Works in Node.js and all browsers. <br>Alphabet: ***Alphanumeric***\n\n\n## Usage\n\n```js\nimport { uid } from 'uid';\n// or: import { uid } from 'uid/secure';\n// or: import { uid } from 'uid/single';\n\n// length = 11 (default)\nuid(); //=> 'c92054d1dd6'\nuid(); //=> 'ac84bbb3728'\n\n// customize length\nuid(16); //=> '8234dbf9a7dcec3b'\nuid(25); //=> '4bbb3728b7a00a12209ec5ff5'\nuid(32); //=> 'dcbc3e65506a7e6f15d30a357e884432'\n```\n\n\n## API\n\n### uid(length?)\nReturns: `String`\n\nCreates a new random identifer of fixed length.\n\n#### length\nType: `Number`<br>\nDefault: `11`\n\nThen length of the output string.\n\n> **Important:** Your risk of collisions decreases with longer strings!\n\n\n## Benchmarks\n\nYou can run the benchmark(s) yourself via the [`/bench`](/bench) directory.\n\nAll items listed pass a validation step for length and uniqueness. <br>\nItems marked with a `†` are cryptographically secure (via CSPRNG).\n\n\n> Running on Node.js v12.18.4\n\n```\nBenchmark (length = 11):\n  hashids/fixed        x   387,306 ops/sec ±1.03% (92 runs sampled)\n  nanoid/non-secure    x  5,338,433 ops/sec ±0.20% (95 runs sampled)\n† nanoid               x  2,705,158 ops/sec ±0.31% (95 runs sampled)\n† uid/secure           x  9,648,755 ops/sec ±0.18% (96 runs sampled)\n  uid/single           x  4,843,529 ops/sec ±0.19% (96 runs sampled)\n  uid                  x 21,276,788 ops/sec ±0.37% (94 runs sampled)\n\nBenchmark (length = 16):\n  hashids/fixed        x    409,228 ops/sec ±0.36% (98 runs sampled)\n  nanoid/non-secure    x  3,643,896 ops/sec ±1.27% (96 runs sampled)\n† nanoid               x  2,273,555 ops/sec ±0.15% (95 runs sampled)\n† uid/secure           x  9,167,545 ops/sec ±0.32% (95 runs sampled)\n  uid/single           x  3,624,579 ops/sec ±0.29% (95 runs sampled)\n  uid                  x 24,770,463 ops/sec ±0.41% (97 runs sampled)\n\nBenchmark (length = 25):\n  cuid                 x    177,241 ops/sec ±1.38% (91 runs sampled)\n  hashids/fixed        x    396,013 ops/sec ±0.21% (98 runs sampled)\n  nanoid/non-secure    x  2,477,463 ops/sec ±0.37% (96 runs sampled)\n† nanoid               x  1,794,062 ops/sec ±0.18% (97 runs sampled)\n† uid/secure           x  3,778,663 ops/sec ±0.16% (95 runs sampled)\n  uid/single           x  2,428,167 ops/sec ±0.27% (96 runs sampled)\n  uid                  x 24,580,091 ops/sec ±0.31% (96 runs sampled)\n\nBenchmark (length = 36):\n  uuid/v1              x  1,738,574 ops/sec ±0.36% (97 runs sampled)\n  uuid/v4              x  1,276,888 ops/sec ±0.26% (94 runs sampled)\n  hashids/fixed        x    374,294 ops/sec ±0.14% (98 runs sampled)\n  nanoid/non-secure    x  1,816,630 ops/sec ±0.31% (97 runs sampled)\n† nanoid               x  1,364,928 ops/sec ±0.18% (95 runs sampled)\n† @lukeed/uuid/secure  x  5,144,752 ops/sec ±0.28% (93 runs sampled)\n  @lukeed/uuid         x  5,950,932 ops/sec ±0.53% (95 runs sampled)\n† uid/secure           x  5,163,209 ops/sec ±0.32% (96 runs sampled)\n  uid/single           x  1,755,748 ops/sec ±0.24% (99 runs sampled)\n  uid                  x 20,166,119 ops/sec ±0.66% (94 runs sampled)\n```\n\n> Running on Chrome 85.0.4183.121\n\n```\nBenchmark (length = 11):\n  hashids/fixed        x    369,393 ops/sec ±1.04% (67 runs sampled)\n  nanoid/non-secure    x  4,741,795 ops/sec ±0.67% (68 runs sampled)\n† nanoid               x    176,138 ops/sec ±7.17% (57 runs sampled)\n† uid/secure           x  2,061,703 ops/sec ±3.95% (65 runs sampled)\n  uid/single           x  4,547,527 ops/sec ±0.29% (67 runs sampled)\n  uid                  x 21,073,518 ops/sec ±0.60% (67 runs sampled)\n\nBenchmark (length = 16):\n  hashids/fixed        x    362,882 ops/sec ±0.25% (67 runs sampled)\n  nanoid/non-secure    x  3,245,036 ops/sec ±1.05% (67 runs sampled)\n† nanoid               x    165,535 ops/sec ±5.21% (59 runs sampled)\n† uid/secure           x  1,676,705 ops/sec ±0.25% (68 runs sampled)\n  uid/single           x  3,322,695 ops/sec ±0.49% (67 runs sampled)\n  uid                  x 24,074,441 ops/sec ±0.35% (67 runs sampled)\n\nBenchmark (length = 25):\n  cuid                 x     99,011 ops/sec ±6.09% (57 runs sampled)\n  hashids/fixed        x    349,187 ops/sec ±0.21% (68 runs sampled)\n  nanoid/non-secure    x  2,245,251 ops/sec ±1.21% (61 runs sampled)\n† nanoid               x    143,529 ops/sec ±4.53% (62 runs sampled)\n† uid/secure           x    936,133 ops/sec ±2.14% (67 runs sampled)\n  uid/single           x  2,276,265 ops/sec ±1.17% (66 runs sampled)\n  uid                  x 23,409,912 ops/sec ±1.81% (67 runs sampled)\n\nBenchmark (length = 36):\n  uuid/v1              x  1,695,352 ops/sec ±0.26% (67 runs sampled)\n  uuid/v4              x    294,032 ops/sec ±1.75% (63 runs sampled)\n  hashids/fixed        x    340,402 ops/sec ±0.37% (50 runs sampled)\n  nanoid/non-secure    x  1,611,905 ops/sec ±0.45% (66 runs sampled)\n† nanoid               x    118,006 ops/sec ±6.31% (52 runs sampled)\n† @lukeed/uuid/secure  x    859,592 ops/sec ±0.54% (67 runs sampled)\n  @lukeed/uuid         x  6,041,873 ops/sec ±0.33% (66 runs sampled)\n† uid/secure           x    776,658 ops/sec ±0.31% (56 runs sampled)\n  uid/single           x  1,646,199 ops/sec ±1.17% (66 runs sampled)\n  uid                  x 22,779,817 ops/sec ±0.66% (67 runs sampled)\n```\n\n## Performance\n\nThe reason `uid` and `uid/secure` are so much faster than its alternatives is two-fold:\n\n1) It composes an output with hexadecimal pairs (from a cached dictionary) instead of single characters.\n2) It allocates a larger Buffer/ArrayBuffer up front (expensive) and slices off chunks as needed (cheap).\n\nThe `uid/secure` module maintains an internal ArrayBuffer of 4096 bytes, which supplies **256** `uid()` invocations. However, the default module (`uid`) preallocates **512** invocations using less memory upfront. Both implementations will regenerate its internal allocation as needed.\n\nLarger buffers would result in higher performance over time, but I found these to be a good balance of performance and memory space.\n\n> **Note:** If you want to don't want to preallocate memory, and do not need a CSPRNG, check out the `uid/single` mode.\n\n\n## Related\n\n- [hexoid](https://github.com/lukeed/hexoid) - A slightly larger (190B) but extremely fast variant of this module with a different API\n- [@lukeed/uuid](https://github.com/lukeed/uuid) - A tiny (230B), fast, and cryptographically secure UUID (V4) generator for Node and the browser\n\n## Credits\n\nThank you [Matthew Mueller](https://github.com/matthewmueller) for gifting the `uid` name on npm.<br>\nThis module was previously known as `foid` (fast object IDs).\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"time":{"modified":"2023-07-12T19:13:39.256Z","created":"2012-12-16T17:18:39.172Z","0.0.1":"2012-12-16T17:18:40.512Z","0.0.2":"2013-07-15T23:37:16.597Z","1.0.0":"2020-03-04T20:19:52.011Z","2.0.0":"2020-10-29T17:05:46.556Z","2.0.1":"2022-09-29T15:48:57.635Z","2.0.2":"2023-03-31T20:29:58.322Z"},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"repository":{"type":"git","url":"git+https://github.com/lukeed/uid.git"},"users":{"meggesje":true,"maximilianschmitt":true,"qqcome110":true,"ajk":true,"liruiqing":true,"gzg1500521074":true,"chaoliu":true,"malloryerik":true,"flumpus-dev":true},"keywords":["id","uid","uuid","random","generate","secure","crypto","foid"],"license":"MIT","readmeFilename":"readme.md","homepage":"https://github.com/lukeed/uid#readme","bugs":{"url":"https://github.com/lukeed/uid/issues"}}