Options
All
  • Public
  • Public/Protected
  • All
Menu

@stephen-shopopop/ulid

Minimal node version Minimal npm version Maintenance Linux macOS Visual Studio Code

Generate ULID

   01AN4Z07BY      79KA1307SR9X4MV3
|----------| |----------------|
Timestamp Entropy
10 chars 16 chars
48bits 80bits
base32 base32

Description

Generate ULID

  • Is compatible with UUID/GUID's
  • 1.21e+24 unique ULIDs per millisecond (1,208,925,819,614,629,174,706,176 to be exact)
  • Lexicographically sortable
  • Canonically encoded as a 26 character string, as opposed to the 36 character UUID
  • Uses Crockford's base32 for better efficiency and readability (5 bits per character)
  • Case insensitive
  • No special characters (URL safe)

NODEJS

Minimal node version

Installation

Add .npmrc file in your repository

@stephen-shopopop:registry=https://npm.pkg.github.com

npm install @stephen-shopopop/ulid@1.2.1

Usage

import { ulid } from "@stephen-shopopop/ulid"

ulid() // 01FW7DJFPDVRRTZZ2UDEE5GW2T
import { monotonic } from "@stephen-shopopop/ulid"

const ulid = monotonic()

ulid() // 01FWXNVK9DWNT24RR10X35F3KZ

ulid(1646295334605) // 01FWXNVK9D0WNT24RR10X35F3M
ulid(1646295334605) // 01FWXNVK9D0WNT24RR10X35F3N

Contributing

  1. npm run build - Build library.
  2. npm run start - start project
  3. npm run test - Run test with jest.
  4. npm run lint - Lint your code.
  5. npm run lint:fix - Lint & fix your code.
  6. npm run typecheck - Run typescript check.
  7. npm run doc - Generate html doc.
  8. npm run release - Release library
  9. npm run fix - Fix library

Generated using TypeDoc