Skip to content

Latest commit

 

History

History
33 lines (20 loc) · 1.18 KB

README.md

File metadata and controls

33 lines (20 loc) · 1.18 KB

TypeScript ULID Generator

This package provides a lightweight, dependency-free utility for generating Universally Unique Lexicographically Sortable Identifiers (ULIDs) in TypeScript applications. ULIDs offer a sortable alternative to UUIDs, combining a timestamp with a series of random characters in a way that can be sorted lexicographically.

Features

  • Lightweight and Fast: No external dependencies.
  • Type-Safe: Fully implemented in TypeScript, providing type safety out of the box.
  • Universally Unique: Generates ULIDs that are unique across time and space.
  • Lexicographically Sortable: ULIDs are sortable by their creation time.

Usage

Import the generateULID function from the package and use it to generate a ULID:

import { generateULID } from '@yi/ulid';

const ulid = generateULID();
console.log(ulid); // Example output: 01F8MECHZX3TBDSZ7XRADM79XE

API

  • generateULID(): string Generates and returns a new ULID as a string.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Inspired by the original ULID specification.