fable-uuid
v3.0.14
Published
A simple UUID Generator.
Readme
Fable-UUID
A simple, flexible UUID generator for Node.js and browsers.
Features
- RFC 4122 v4 UUIDs - Standards-compliant UUID generation using cryptographic random bytes
- Random String Mode - Configurable length and character dictionary for custom identifiers
- Cross-Platform - Works in Node.js (via
crypto) and browsers (via WebCrypto API with fallbacks) - Fable Service Provider - Integrates as a service in the Fable ecosystem
- Minimal Dependencies - Only depends on
fable-serviceproviderbase
Installation
npm install fable-uuidQuick Start
const libFableUUID = require('fable-uuid');
// Standard v4 UUID
const uuid = new libFableUUID();
console.log(uuid.getUUID());
// => "f47ac10b-58cc-4372-a567-0e02b2c3d479"
// Random string mode
const shortId = new libFableUUID({ UUIDModeRandom: true, UUIDLength: 12 });
console.log(shortId.getUUID());
// => "a1B2c3D4e5F6"Configuration
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| UUIDModeRandom | boolean | false | Enable random string mode instead of v4 UUIDs |
| UUIDLength | number | 8 | Length of generated string in random mode |
| UUIDDictionary | string | '0123456789abcdef...XYZ' | Character set for random mode |
Documentation
Full documentation is available at stevenvelozo.github.io/fable-uuid.
Related Packages
- fable - Application services framework
- fable-serviceproviderbase - Service provider base class
License
MIT
Contributing
Pull requests are welcome. For details on our code of conduct, contribution process, and testing requirements, see the Retold Contributing Guide.
