{"id":24874627,"url":"https://github.com/dirheimerb/uuid-generator","last_synced_at":"2026-02-13T11:51:06.171Z","repository":{"id":180750072,"uuid":"665644829","full_name":"dirheimerb/uuid-generator","owner":"dirheimerb","description":"A UUID generator library for TypeScript","archived":false,"fork":false,"pushed_at":"2023-10-26T23:45:05.000Z","size":60,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-29T21:25:51.203Z","etag":null,"topics":["javascript","nodejs","typescript","uuid"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dirheimerb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-07-12T17:01:57.000Z","updated_at":"2025-07-28T13:12:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"9cd11982-7189-4926-b20a-03b25f544553","html_url":"https://github.com/dirheimerb/uuid-generator","commit_stats":null,"previous_names":["dirheimerb/uuid-generator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dirheimerb/uuid-generator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirheimerb%2Fuuid-generator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirheimerb%2Fuuid-generator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirheimerb%2Fuuid-generator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirheimerb%2Fuuid-generator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dirheimerb","download_url":"https://codeload.github.com/dirheimerb/uuid-generator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dirheimerb%2Fuuid-generator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29404111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-13T06:24:03.484Z","status":"ssl_error","status_checked_at":"2026-02-13T06:23:12.830Z","response_time":78,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","nodejs","typescript","uuid"],"created_at":"2025-02-01T07:28:02.546Z","updated_at":"2026-02-13T11:51:06.154Z","avatar_url":"https://github.com/dirheimerb.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# UUID Wand\n\nUUID Wand is a TypeScript library that provides functionality to generate and validate UUIDs (Universally Unique Identifiers).\n\n[Docs](https://dirheimerb.github.io/uuid-generator)\n\n## Table of Contents\n\n- [UUID Wand](#uuid-wand)\n  - [Table of Contents](#table-of-contents)\n  - [Installation](#installation)\n  - [Usage](#usage)\n    - [Generating UUIDs](#generating-uuids)\n    - [Validating UUIDs](#validating-uuids)\n    - [Bulk Generation](#bulk-generation)\n    - [Timestamp Retrieval](#timestamp-retrieval)\n    - [Short UUID](#short-uuid)\n  - [License](#license)\n\n## Installation\n\nTo use this library in your project, make sure you have Node.js installed. Follow the steps below to install and use the library:\n\n1. Clone the repository or download the source code files.\n2. Install the required dependencies by running the following command in the project directory:\n\n   ```bash\n   npm install uuid-wand\n   ```\n\n   ```bash\n   yarn add uuid-wand\n   ```\n\n   ```bash\n   pnpm add uuid-wand\n   ```\n\n3. Import the `UuidGenerator` class into your TypeScript file:\n\n   ```typescript\n   import UuidGenerator from 'uuid-wand';\n   ```\n\n## Usage\n\n### Generating UUIDs\n\nThe `UuidGenerator` class provides four methods for generating UUIDs:\n\n- `v1()`: Generates a version 1 UUID using the current timestamp, clock sequence, and node ID.\n\n  ```typescript\n  const uuidV1 = UuidGenerator.v1();\n  console.log(uuidV1); // Output: e.g., '6a365c44-e127-11eb-b95f-cb258f9664de'\n  ```\n\n- `v3(namespace: string, name: string)`: Generates a version 3 UUID using the provided namespace and name.\n\n  ```typescript\n  const uuidV3 = UuidGenerator.v3(\n    '6ba7b810-9dad-11d1-80b4-00c04fd430c8',\n    'Hello, World!',\n  );\n  console.log(uuidV3); // Output: e.g., '2ed6657d-e927-568b-95e1-2665a8aea6a2'\n  ```\n\n- `v4()`: Generates a version 4 UUID using random values.\n\n  ```typescript\n  const uuidV4 = UuidGenerator.v4();\n  console.log(uuidV4); // Output: e.g., 'd6e3c7b6-8e47-4a3c-a31c-78168d0b96cd'\n  ```\n\n- `v5(namespace: string, name: string)`: Generates a version 5 UUID using the provided namespace and name.\n\n  ```typescript\n  const uuidV5 = UuidGenerator.v5(\n    '6ba7b811-9dad-11d1-80b4-00c04fd430c8',\n    'Hello, World!',\n  );\n  console.log(uuidV5); // Output: e.g., '886313e1-3b8a-5372-9b90-0c9aee199e5d'\n  ```\n\n### Validating UUIDs\n\n- The `validate()` method can be used to check if a given string is a valid UUID.\n\n```typescript\nconst uuid = '6a365c44-e127-11eb-b95f-cb258f9664de';\nconst isValid = UuidGenerator.validate(uuid);\nconsole.log(isValid); // Output: true\n```\n\n### Bulk Generation\n\n- The method bulkGenerateV4 takes an integer count as an argument and returns an array of version 4 UUIDs.\n\n```typescript\nconst uuids = UuidGenerator.bulkGenerateV4(5);\nconsole.log(uuids);\n// Output:\n// [\n//   'd6e3c7h6-8e47-4a3c-a31c-78168d0b96jd',\n//   'd6e3c7b6-8h47-4a3c-a31c-78168d0b96ca',\n//   'd6e3c7b6-8347-4g3c-a31c-78168d0b96cq',\n//   'd6e3c7b6-8e47-4d3c-a31c-78168d0b96cj',\n//   'd6e3c7b6-8e47-4a3c-b31c-78168d0b96cl'\n```\n\n### Timestamp Retrieval\n\n- The method extractTimestampV1 extracts the timestamp from a version 1 UUID string. It returns the timestamp as a number or null if the UUID is not valid or not a version 1 UUID. The extraction logic relies on bit manipulation and should be fairly efficient.\n\n```typescript\nconst uuid = '6a365c44-e127-11eb-b95f-cb258f9664de';\nconst timestamp = UuidGenerator.extractTimestampV1(uuid);\nconsole.log(timestamp); // Output: 1625765020000\n```\n\n### Short UUID\n\n- The method shortUuid creates a shorter, URL-friendly UUID by generating a version 4 UUID, hashing it with MD5, and then encoding it using base64. Any characters not safe for URLs are replaced.\n\n```typescript\nconst shortUuid = UuidGenerator.shortUuid();\nconsole.log(shortUuid); // Output: '1b9d6bcd-bbfd-4b2d-9b5d-ab8dfbbd4bed'\n```\n\n## License\n\nThis library is released under the [MIT License](LICENSE). Feel free to modify and use it in your projects.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirheimerb%2Fuuid-generator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdirheimerb%2Fuuid-generator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdirheimerb%2Fuuid-generator/lists"}