Generate and translate standard UUIDs into shorter - or just different - formats and back.
var short = ;// Quick start with flickrBase58 formatshort; // 73WakrfVbNJBaAmhQtEeDv
short-uuid starts with RFC4122 v4-compliant UUIDs and translates them into other, usually shorter formats. It also provides translators to convert back and forth from RFC complaint UUIDs to the shorter formats.
var short = ;var translator = ; // Defaults to flickrBase58var decimalTranslator = ; // Provide a specific alphabet for translationvar cookieTranslator = ; // Use a constant for translation// Generate a shortened v4 UUIDtranslator; // mhvXdrZT4jP5T8vBxuvm75translator; // An alias for new.// Translate UUIDs to and from the shortened formattranslator;// a44521d0-0fb8-4ade-8002-3385545c3318translator; // mhvXdrZT4jP5T8vBxuvm75// Generate plain UUIDs// - From the library without creating a translatorshort; // fd5c084c-ff7c-4651-9a52-37096242d81c// - Each translator provides the uuid.v4() function, tootranslator; // 3023b0f5-ec55-4e75-9cd8-104700698052// See the alphabet used by a translatortranslatoralphabet;// View the constantsshortconstantsflickrBase58; // Avoids similar characters (0/O, 1/I/l, etc.)shortconstantscookieBase90; // Safe for HTTP cookies values for smaller IDs.
short-uuid has been tested to work on Node 0.10.x and later. Builds run on Node 6.x and later.
short-uuid provides RFC4122 v4-compliant UUIDs,
It includes Browserify support for client-side use as proposed
by voronianski, with compiled,
browser-ready files in the npm package for convenience.
The library is exposed as
TypeScript definitions are included, thanks to alexturek.
short-uuid is under 1.2K when compressed. Using Browserify, the library and dependencies are ~3.6K.
Recent Release Notes
generate() for ease of use. Last version to build on Node 4.x.
3.0.0 updates dependencies, includes a refactor for CodeClimate, and drops Node 0.x builds.
2.3.4 corrects the behavior for UUIDs with uppercase letters. Last version to build on Node 0.x.
Please see Revisions for information on previous versions.