{"_id":"@agoralabs-sh/uuid","_rev":"1-464e5b7c7ebf08fe1073bc52abe755d1","name":"@agoralabs-sh/uuid","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@agoralabs-sh/uuid","version":"1.0.0","author":{"url":"https://github.com/kieranroneill","name":"Kieran O'Neill","email":"hello@kieranoneill.com"},"license":"CC0-1.0","_id":"@agoralabs-sh/uuid@1.0.0","maintainers":[{"name":"agoralabs-bot","email":"tech@agoralabs.sh"},{"name":"kieranroneill","email":"kieran.oneill@pm.me"}],"homepage":"https://github.com/agoralabs-sh/avm-tools#readme","bugs":{"url":"https://github.com/agoralabs-sh/avm-tools/issues"},"dist":{"shasum":"f02f80260c2caffcc6caaaca2e6da9922fe4d2ee","tarball":"https://registry.npmjs.org/@agoralabs-sh/uuid/-/uuid-1.0.0.tgz","fileCount":12,"integrity":"sha512-RoI8VXexzpygFzTFCxwppXsCeY6k7UwRk7m7qLzLwf4NKhDcKCpJITx9BCSWwdesTa+7bn2Plh5YgL9p1/Ljyw==","signatures":[{"sig":"MEYCIQDyVRj2+QquC5rq0OjGenh/CqF5mwSTtLiPXW1w0EMe+QIhAKScXdInOJ1ai1logp7TPenQwKTD5nhUNqMqGzgLNXka","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14431},"main":"dist/index.js","type":"module","_from":"file:agoralabs-sh-uuid-1.0.0.tgz","types":"dist/index.d.ts","private":false,"scripts":{"lint":"eslint .","test":"exit 0","build":"pnpm run clean && vite build","clean":"shx rm -rf dist && shx rm -rf tsconfig.*.tsbuildinfo","prettier":"prettier --write \"**/*.{cjs,js,json,mjs,ts}\"","generate:index":"tsx ./scripts/generate-index.ts","build:dependencies":"exit 0"},"_npmUser":{"name":"agoralabs-bot","email":"tech@agoralabs.sh"},"_resolved":"/tmp/dbce1b87f926136ccbfd540e0c948e1c/agoralabs-sh-uuid-1.0.0.tgz","_integrity":"sha512-RoI8VXexzpygFzTFCxwppXsCeY6k7UwRk7m7qLzLwf4NKhDcKCpJITx9BCSWwdesTa+7bn2Plh5YgL9p1/Ljyw==","repository":{"url":"git+https://github.com/agoralabs-sh/avm-tools.git","type":"git"},"_npmVersion":"10.8.2","description":"A UUID v4 utility package that allows generation and encoding/decoding.","directories":{},"_nodeVersion":"20.18.0","dependencies":{"@stablelib/hex":"^2.0.1","@stablelib/uuid":"^2.0.1"},"_hasShrinkwrap":false,"devDependencies":{"shx":"^0.3.4","tsx":"^4.19.2","vite":"^6.0.3","chalk":"^5.3.0","eslint":"^9.16.0","globals":"^15.13.0","prettier":"^3.2.5","@eslint/js":"^9.16.0","typescript":"^5.7.2","@types/node":"^22.10.1","vite-plugin-dts":"^4.3.0","typescript-eslint":"^8.18.0","vite-tsconfig-paths":"^5.1.4","eslint-config-prettier":"^9.1.0"},"_npmOperationalInternal":{"tmp":"tmp/uuid_1.0.0_1740223537489_0.4938842336593947","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@agoralabs-sh/uuid","version":"1.1.0","description":"A UUID v4 utility package that allows generation and encoding/decoding.","repository":{"type":"git","url":"git+https://github.com/agoralabs-sh/avm-tools.git"},"author":{"name":"Kieran O'Neill","email":"hello@kieranoneill.com","url":"https://github.com/kieranroneill"},"license":"CC0-1.0","private":false,"type":"module","main":"dist/index.js","types":"dist/index.d.ts","dependencies":{"@stablelib/hex":"^2.0.1","@stablelib/uuid":"^2.0.1"},"devDependencies":{"@eslint/js":"^9.16.0","@types/node":"^22.10.1","chalk":"^5.3.0","eslint":"^9.16.0","eslint-config-prettier":"^9.1.0","globals":"^15.13.0","prettier":"^3.2.5","shx":"^0.3.4","tsx":"^4.19.2","typescript":"^5.7.2","typescript-eslint":"^8.18.0","vite":"^6.0.3","vite-plugin-dts":"^4.3.0","vite-tsconfig-paths":"^5.1.4","vitest":"^3.0.5"},"scripts":{"build":"pnpm run clean && vite build","build:dependencies":"exit 0","clean":"shx rm -rf dist && shx rm -rf tsconfig.*.tsbuildinfo","generate:index":"tsx ./scripts/generate-index.ts","lint":"eslint .","prettier":"prettier --write \"**/*.{cjs,js,json,mjs,ts}\"","test":"vitest run --config vitest.config.ts"},"_id":"@agoralabs-sh/uuid@1.1.0","bugs":{"url":"https://github.com/agoralabs-sh/avm-tools/issues"},"homepage":"https://github.com/agoralabs-sh/avm-tools#readme","_integrity":"sha512-Or/N9YG/zAnrSzZrG4Dlu9/vxMzU8tjpKjUBoGrSC3C/vAGlPRuxNMt0GGiJjuEqe/JtLb+IOYC8LISaHrT3rw==","_resolved":"/tmp/3b7e5843af5b2c981d6f3041ab3523eb/agoralabs-sh-uuid-1.1.0.tgz","_from":"file:agoralabs-sh-uuid-1.1.0.tgz","_nodeVersion":"20.18.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-Or/N9YG/zAnrSzZrG4Dlu9/vxMzU8tjpKjUBoGrSC3C/vAGlPRuxNMt0GGiJjuEqe/JtLb+IOYC8LISaHrT3rw==","shasum":"aee1559b9fd3898a07d87ef019db92e33f67f199","tarball":"https://registry.npmjs.org/@agoralabs-sh/uuid/-/uuid-1.1.0.tgz","fileCount":28,"unpackedSize":20882,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHbN4X8hw+spriTdosI38bQtfn2W8S6n0GHGY3rbsNheAiBB6rEWZy4duIRkrEOmyyW1XMInyDaGh0YmGgiPLFCrTQ=="}]},"_npmUser":{"name":"agoralabs-bot","email":"tech@agoralabs.sh"},"directories":{},"maintainers":[{"name":"agoralabs-bot","email":"tech@agoralabs.sh"},{"name":"kieranroneill","email":"kieran.oneill@pm.me"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/uuid_1.1.0_1740244448235_0.6686387423455213"},"_hasShrinkwrap":false}},"time":{"created":"2025-02-22T11:25:37.413Z","modified":"2025-02-22T17:14:08.643Z","1.0.0":"2025-02-22T11:25:37.717Z","1.1.0":"2025-02-22T17:14:08.440Z"},"bugs":{"url":"https://github.com/agoralabs-sh/avm-tools/issues"},"author":{"name":"Kieran O'Neill","email":"hello@kieranoneill.com","url":"https://github.com/kieranroneill"},"license":"CC0-1.0","homepage":"https://github.com/agoralabs-sh/avm-tools#readme","repository":{"type":"git","url":"git+https://github.com/agoralabs-sh/avm-tools.git"},"description":"A UUID v4 utility package that allows generation and encoding/decoding.","maintainers":[{"name":"agoralabs-bot","email":"tech@agoralabs.sh"},{"name":"kieranroneill","email":"kieran.oneill@pm.me"}],"readme":"<div align=\"center\">\n\n[![License: CC0-1.0](https://img.shields.io/badge/License-CC0_1.0-brightgreen.svg)](./LICENSE)\n[![NPM Version](https://img.shields.io/npm/v/%40agoralabs-sh%2Fuuid)](https://www.npmjs.com/package/%40agoralabs-sh/uuid)\n\n</div>\n\n<div align=\"center\">\n\n![GitHub Release](https://img.shields.io/github/v/release/agoralabs-sh/avm-tools?filter=%40agoralabs-sh%2Fuuid*)\n![GitHub Release](https://img.shields.io/github/v/release/agoralabs-sh/avm-tools?include_prereleases&filter=%40agoralabs-sh%2Fuuid*&label=pre-release)\n\n</div>\n\n<h1 align=\"center\">\n  @agoralabs/uuid\n</h1>\n\n<p align=\"center\">\n  A UUID v4 utility package that allows generation and encoding/decoding.\n</p>\n\n---\n\n### Table of Contents\n\n* [1. Getting Started](#-1-getting-started)\n  - [1.1. Installation](#11-installation)\n  - [1.2. API Reference](#12-api-reference)\n    - [1.2.1. `generate([options])`](#121-generateoptions)\n    - [1.2.2. `decode(value)`](#122-decodevalue)\n    - [1.2.3. `encode(value, [options])`](#123-encodevalue-options)\n    - [1.2.4. `IExtraOptions`](#124-iextraoptions)\n* [2. Appendix](#-2-appendix)\n  - [2.1. Useful Commands](#21-useful-commands)\n* [3. How To Contribute](#-3-how-to-contribute)\n* [4. License](#-4-license)\n* [5. Credits](#-5-credits)\n\n## 🪄 1. Getting Started\n\n### 1.1. Installation\n\nYou can install the types using:\n```shell\nnpm add @agoralabs-sh/uuid\n```\n\n<sup>[Back to top ^][table-of-contents]</sup>\n\n### 1.2. API Reference\n\n#### 1.2.1. `generate([options])`\n\n> Generates a random UUID v4 string.\n\n##### Parameters\n\n| Name    | Type                                  | Required | Default | Description                                                  |\n|---------|---------------------------------------|----------|---------|--------------------------------------------------------------|\n| options | [`IExtraOptions`](#124-iextraoptions) | no       | -       | Options that allows the UUID to to be returned to uppercase. |\n\n##### Returns\n\n| Type     | Description              |\n|----------|--------------------------|\n| `string` | A random UUID v4 string. |\n\n##### Example\n\n```typescript\nimport { generate } from '@agoralabs-sh/uuid';\n\nconst uuid = generate();\n\nconsole.log(uuid);\n// 18b0e62a-21c6-4e27-a813-825716f0fedb\n```\n\n<sup>[Back to top ^][table-of-contents]</sup>\n\n#### 1.2.2. `decode(value)`\n\n> Decodes the UUID into a byte array. This removes any hyphens and case is preserved.\n\n##### Parameters\n\n| Name  | Type     | Required | Default | Description        |\n|-------|----------|----------|---------|--------------------|\n| value | `string` | yes      | -       | The UUID to decode |\n\n##### Returns\n\n| Type         | Description        |\n|--------------|--------------------|\n| `Uint8Array` | The UUID as bytes. |\n\n##### Example\n\n```typescript\nimport { decode } from '@agoralabs-sh/uuid';\n\nconst decoded = decode('18b0e62a-21c6-4e27-a813-825716f0fedb');\n\nconsole.log(decoded);\n// [24, 176, 230, 42, 33, 198, 78, 39, 168, 19, 130, 87, 22, 240, 254, 219]\n```\n\n<sup>[Back to top ^][table-of-contents]</sup>\n\n#### 1.2.3. `encode(value, [options])`\n\n> Encodes the UUID into the human-readable format with hyphens added.\n\n##### Parameters\n\n| Name    | Type                                  | Required | Default | Description                                                  |\n|---------|---------------------------------------|----------|---------|--------------------------------------------------------------|\n| value   | `Uint8Array`                          | yes      | -       | A UUID byte array.                                           |\n| options | [`IExtraOptions`](#124-iextraoptions) | no       | -       | Options that allows the UUID to to be returned to uppercase. |\n\n##### Returns\n\n| Type     | Description                                         |\n|----------|-----------------------------------------------------|\n| `string` | The encoded UUID string as a human-readable string. |\n\n##### Example\n\n```typescript\nimport { encode } from '@agoralabs-sh/uuid';\n\nconst uuid = encode(new Uint8Array([24, 176, 230, 42, 33, 198, 78, 39, 168, 19, 130, 87, 22, 240, 254, 219]));\n\nconsole.log(uuid);\n// 18b0e62a-21c6-4e27-a813-825716f0fedb\n```\n\n<sup>[Back to top ^][table-of-contents]</sup>\n\n#### 1.2.4. `IExtraOptions`\n\n| Name      | Type                                                     | Required | Default | Description                                   |\n|-----------|----------------------------------------------------------|----------|---------|-----------------------------------------------|\n| uppercase | `boolean`                                                | no       | `false` | Whether the UUID is transformed to uppercase. |\n\n<sup>[Back to top ^][table-of-contents]</sup>\n\n## 📑 2. Appendix\n\n### 2.1. Useful Commands\n\n| Command                   | Description                                                                 |\n|---------------------------|-----------------------------------------------------------------------------|\n| `pnpm run build`          | Generates build and TypeScript declaration files to the `dist/` directory.  |\n| `pnpm run clean`          | Deletes the `dist/` directory and the `tsconfig.*.tsbuildinfo` files.       |\n| `pnpm run generate:index` | Generates/overwrites the main `index.ts` file used for exporting all files. |\n| `pnpm run lint`           | Runs the linter based on the rules in `eslint.config.mjs`.                  |\n| `pnpm run prettier`       | Runs the prettier based on the rules in `prettier.config.mjs`.              |\n\n<sup>[Back to top ^][table-of-contents]</sup>\n\n## 👏 3. How To Contribute\n\nPlease read the [**Contributing Guide**][contribute] to learn about the development process.\n\n<sup>[Back to top ^][table-of-contents]</sup>\n\n## 📄 4. License\n\nPlease refer to the [LICENSE][license] file.\n\n<sup>[Back to top ^][table-of-contents]</sup>\n\n## 🫶 5. Credits\n\n* The generation of the UUID is thanks to the amazing [@dhest](https://github.com/dchest) and their amazing [@stablelib](https://github.com/StableLib/stablelib) library.\n\n<sup>[Back to top ^][table-of-contents]</sup>\n\n<!-- links -->\n[contribute]: ../../CONTRIBUTING.md\n[license]: LICENSE\n[table-of-contents]: #table-of-contents\n\n","readmeFilename":"README.md"}