Skip to content

This package provides a lightweight, dependency-free utility for generating Universally Unique Lexicographically Sortable Identifiers (ULIDs) in TypeScript applications.

License

ayoubezzini/ulid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

This package provides a lightweight, dependency-free utility for generating Universally Unique Lexicographically Sortable Identifiers (ULIDs) in TypeScript applications.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published