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.
- 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.
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
generateULID(): string
Generates and returns a new ULID as a string.
This project is licensed under the MIT License - see the LICENSE file for details.
Inspired by the original ULID specification.