npm.io
3.0.15 • Published 4 months ago

fable-uuid

Licence
MIT
Version
3.0.15
Deps
1
Size
172 kB
Vulns
0
Weekly
0

Fable-UUID

Read the Fable-UUID Documentation

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-uuid

Quick 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 fable-retold.github.io/fable-uuid.

License

MIT

Contributing

Pull requests are welcome. For details on our code of conduct, contribution process, and testing requirements, see the Retold Contributing Guide.

Keywords