{"id":13525758,"url":"https://github.com/oculus42/short-uuid","last_synced_at":"2025-05-14T03:11:13.121Z","repository":{"id":51356047,"uuid":"60438149","full_name":"oculus42/short-uuid","owner":"oculus42","description":"Translate standard UUIDs into shorter formats and back.","archived":false,"fork":false,"pushed_at":"2025-03-18T01:18:03.000Z","size":813,"stargazers_count":491,"open_issues_count":5,"forks_count":14,"subscribers_count":4,"default_branch":"develop","last_synced_at":"2025-05-05T21:36:46.782Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/oculus42.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-06-05T01:40:33.000Z","updated_at":"2025-04-29T12:03:44.000Z","dependencies_parsed_at":"2024-01-10T22:09:58.128Z","dependency_job_id":"1a91090c-ae38-47d1-8399-f3e9ae06fe38","html_url":"https://github.com/oculus42/short-uuid","commit_stats":{"total_commits":158,"total_committers":12,"mean_commits":"13.166666666666666","dds":"0.36708860759493667","last_synced_commit":"bdd83c4a6cae19387796ec1e8fdf36129b819b50"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oculus42%2Fshort-uuid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oculus42%2Fshort-uuid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oculus42%2Fshort-uuid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oculus42%2Fshort-uuid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oculus42","download_url":"https://codeload.github.com/oculus42/short-uuid/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253321151,"owners_count":21890349,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-08-01T06:01:21.809Z","updated_at":"2025-05-14T03:11:08.113Z","avatar_url":"https://github.com/oculus42.png","language":"JavaScript","funding_links":[],"categories":["UUID Like","Repository","JavaScript","others"],"sub_categories":["Packages","Text/String"],"readme":"# short-uuid\n\n[![npm](https://img.shields.io/npm/v/short-uuid.svg)](https://www.npmjs.com/package/short-uuid)\n[![Code Climate](https://codeclimate.com/github/oculus42/short-uuid/badges/gpa.svg)](https://codeclimate.com/github/oculus42/short-uuid)\n[![Test Coverage](https://codeclimate.com/github/oculus42/short-uuid/badges/coverage.svg)](https://codeclimate.com/github/oculus42/short-uuid/coverage)\n\nGenerate and translate standard UUIDs into shorter - or just *different* - formats and back.\n\n## v5.2.0\n5.2.0 adds `validate` method to check short IDs. Requested by [@U-4-E-A](https://github.com/U-4-E-A)\n5.1.0 adds translation support for the [uuid25](https://github.com/uuid25/javascript) (Base36) format\nwith the `uuid25Base36` constant.\n\n### Major Changes in 5.0.0\n- 🛑 5.0.0 drops support for Node 10 and 12.\n\n### Quick Start\n\n```javascript\nconst short = require('short-uuid');\n\n// Quick start with flickrBase58 format\nshort.generate(); // '73WakrfVbNJBaAmhQtEeDv'\n```\n\n### Details\n\nshort-uuid starts with RFC4122 v4-compliant UUIDs and translates them\ninto other, usually shorter formats. It also provides translators\nto convert back and forth from RFC compliant UUIDs to the shorter formats,\nand validate the IDs.\n\nAs of 4.0.0, formats return consistent-length values unless specifically requested.\nThis is done by padding the start with the first (`[0]`) character in the alphabet.\nPrevious versions can translate padded formats back to UUID.\n\n```javascript\nconst short = require('short-uuid');\n\n// Generate a flickrBase58 short ID from without creating a translator\nconst shortId = short.generate();\n\nconst translator = short(); // Defaults to flickrBase58\nconst decimalTranslator = short(\"0123456789\"); // Provide a specific alphabet for translation\nconst cookieTranslator = short(short.constants.cookieBase90); // Use a constant for translation\n\n// Generate a shortened v4 UUID\ntranslator.new(); // mhvXdrZT4jP5T8vBxuvm75\ntranslator.generate(); // An alias for new.\n\n// Translate UUIDs to and from the shortened format\ntranslator.toUUID(shortId); // a44521d0-0fb8-4ade-8002-3385545c3318\ntranslator.fromUUID(regularUUID); // mhvXdrZT4jP5T8vBxuvm75\n\n// Check if a string is a valid ID (length and alphabet)\ntranslator.validate(shortId); // true\n\n// Check if a string is valid *AND* translates to a valid UUID\ntranslator.validate(shortId, true); // true\ntranslator.validate('0000000000000000000000', true) // false\n\n// See the alphabet used by a translator\ntranslator.alphabet;\n\n// The maximum length a translated uuid will be with its alphabet.\n// if consistentLength is set (on by default), so ids will be this length.\ntranslator.maxLength;\n\n// View the constants\nshort.constants.cookieBase90; // Safe for HTTP cookies values for smaller IDs.\nshort.constants.flickrBase58; // Avoids similar characters (0/O, 1/I/l, etc.)\nshort.constants.uuid25Base36; // The uuid25 (string length 25) format\n\n// Generate plain UUIDs\n// - From the library without creating a translator\nshort.uuid(); // fd5c084c-ff7c-4651-9a52-37096242d81c\n// - Each translator provides the uuid.v4() function, too\ntranslator.uuid(); // 3023b0f5-ec55-4e75-9cd8-104700698052\n```\n\n### Options\n\nshort-uuid 4.0.0 added support for options when creating a translator.\nThis may support additional configuration in the future.\n\n```javascript\nconst short = require('short-uuid');\n\n// By default shortened values are now padded for consistent length.\n// If you want to produce variable lengths, like in 3.1.1\nconst translator = short(short.constants.flickrBase58, {\n  consistentLength: false,\n});\n\n// Generate a shortened v4 UUID\ntranslator.new(); // mhvXdrZT4jP5T8vBxuvm75\n```\n* `consistentLength` - Controls padding on shortened values. Default is `true`.\n\n## Support\n\nshort-uuid [5.x](https://github.com/oculus42/short-uuid/blob/v5.2.0/README.md)\nand later is tested on Node 14.x and later.\n\nshort-uuid [4.x](https://github.com/oculus42/short-uuid/blob/v3.2.2/README.md)\nwas tested on Node 8.x to 18.x\n\nshort-uuid [3.x](https://github.com/oculus42/short-uuid/blob/v3.1.1/README.md)\nand lower was confirmed to work on Node 6.x to 12.x,\nand offered a precompiled browser library proposed\nby [voronianski](https://github.com/voronianski).\n\n## Notes\n\nshort-uuid provides RFC4122 v4-compliant UUIDs,\nthanks to [`uuid`](https://github.com/uuidjs/uuid).\n\nTypeScript definitions are included, thanks to\n[alexturek](https://github.com/alexturek).\n\n## Previous Release Note Highlights\n5.0.0 drops support for Node 12 and below.\n4.1.0 adds a maxLength value to translators for reference\n4.0.1 adds consistent length translation and throws an error if provided an invalid alphabet.\n3.1.1 removed Node 4.x tests. Last included Browserify distribution.\n2.3.4 corrects the behavior for UUIDs with uppercase letters. Last version to build on Node 0.x.\n\nPlease see [Revisions](revisions.md) for information on previous versions.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foculus42%2Fshort-uuid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foculus42%2Fshort-uuid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foculus42%2Fshort-uuid/lists"}