{"id":50311245,"url":"https://github.com/fajarnugraha37/deno-ulid","last_synced_at":"2026-05-28T21:01:36.075Z","repository":{"id":351826721,"uuid":"875223182","full_name":"fajarnugraha37/deno-ulid","owner":"fajarnugraha37","description":"A fast ULID (Universally unique Lexicographically sortable IDentifier) generator in its class with zero dependencies, no slow types are used, fully type-safe and supporting multiple runtimes. ULID is an alternative to UUID but lexicographically sortable, more efficient, monotonic sort order, URL safe, ideal for databases, logs, and more!","archived":false,"fork":false,"pushed_at":"2024-10-19T15:18:29.000Z","size":157,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-16T17:43:53.498Z","etag":null,"topics":["database","deno","deno-ulid","denoland","generator","identifier","javascript","jsr","lexicography","logs","nodejs","sort","sort-order","sortable","typescript","ulid","ulid-generator","unique-identifier","uuid","uuid-generator"],"latest_commit_sha":null,"homepage":"https://jsr.io/@fajar/deno-ulid","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fajarnugraha37.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-10-19T12:17:50.000Z","updated_at":"2024-11-05T14:06:23.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/fajarnugraha37/deno-ulid","commit_stats":null,"previous_names":["fajarnugraha37/deno-ulid"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fajarnugraha37/deno-ulid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarnugraha37%2Fdeno-ulid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarnugraha37%2Fdeno-ulid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarnugraha37%2Fdeno-ulid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarnugraha37%2Fdeno-ulid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fajarnugraha37","download_url":"https://codeload.github.com/fajarnugraha37/deno-ulid/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fajarnugraha37%2Fdeno-ulid/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33626142,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","deno","deno-ulid","denoland","generator","identifier","javascript","jsr","lexicography","logs","nodejs","sort","sort-order","sortable","typescript","ulid","ulid-generator","unique-identifier","uuid","uuid-generator"],"created_at":"2026-05-28T21:01:34.928Z","updated_at":"2026-05-28T21:01:36.069Z","avatar_url":"https://github.com/fajarnugraha37.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deno ULID Generator\n\n[![JSR Scope](https://jsr.io/badges/@fajar)](https://jsr.io/@fajar)\n[![JSR](https://jsr.io/badges/@fajar/deno-ulid)](https://jsr.io/@fajar/deno-ulid)\n[![JSR Score](https://jsr.io/badges/@fajar/deno-ulid/score)](https://jsr.io/@fajar/deno-ulid)\n\nThis package provides a fast, lightweight, zero dependencies, no slow types are\nused, fully type-safe and supporting multiple runtimes for generating ULIDs\n(Universally Unique Lexicographically Sortable Identifiers). ULIDs offer a\nlexicographically sortable (combine timestamps with a series of random\ncharacters in a lexicographically sortable manner), universally unique,\nefficient, monotonic sort order and URL safe alternative to UUIDs.\n\n## Import\n\nAdd Package:\n\n```bash\n$ deno add jsr:@fajar/deno-ulid\n```\n\nImport symbol:\n\n```typescript\nimport * as mod from \"@fajar/deno-ulid\";\n```\n\nOR Import directly with a jsr specifier\n\n```typescript\nimport * as mod from \"jsr:@fajar/deno-ulid\";\n```\n\n## Usage\n\nTo generate a ULID, simply run the function:\n\n```typescript\nimport { ulid } from \"jsr:@fajar/deno-ulid\";\n\nulid();\n```\n\n### Monotonic ULIDs\n\nTo generate monotonically increasing ULIDs, create a monotonic counter:\n\n```typescript\nimport { monotonicFactory } from \"jsr:@fajar/deno-ulid\";\n\nconst ulid = monotonicFactory();\nulid(100000);\nulid(100000);\nulid(100000);\nulid(100000);\nulid(100000);\n```\n\n### Convert UUID to ULID\n\n```typescript\nimport { uuidToULID } from \"jsr:@fajar/deno-ulid\";\n\nuuidToULID(crypto.randomUUID());\n```\n\n### Convert ULID to UUID\n\n```typescript\nimport { ulidToUUID } from \"jsr:@fajar/deno-ulid\";\n\nconst uuid = crypto.randomUUID();\nulidToUUID(uuid);\n```\n\n## Performance\n\n```bash\n$ deno task benchmark\n```\n\n```bash\nCPU | 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz\nRuntime | Deno 2.0.0 (x86_64-pc-windows-msvc)\n\nfile:///C:/Users/fajar.nugraha/Desktop/workspace/compose/deno-ulid/test/bench.ts\n\nbenchmark      time/iter (avg)        iter/s      (min … max)           p75      p99     p995\n-------------- ----------------------------- --------------------- --------------------------\nencodeTime            265.1 ns     3,772,000 (173.6 ns … 430.4 ns) 288.6 ns 390.9 ns 392.3 ns\ndecodeTime            657.6 ns     1,521,000 (513.6 ns … 993.4 ns) 730.2 ns 993.4 ns 993.4 ns\nencodeRandom            4.9 µs       205,900 (  4.0 µs …   6.0 µs)   5.2 µs   6.0 µs   6.0 µs\ngenerate                7.4 µs       136,000 (  6.3 µs …   8.3 µs)   7.7 µs   8.3 µs   8.3 µs\nulidToUUID              3.9 µs       257,900 (  3.5 µs …   4.6 µs)   4.0 µs   4.6 µs   4.6 µs\nuuidToULID              6.4 µs       157,000 (  5.9 µs …   8.0 µs)   6.5 µs   8.0 µs   8.0 µs\n```\n\n## Test\n\n```bash\n$ deno test\n```\n\n```bash\nrunning 1 test from ./test/test.ts\nulid ...\n  prng ...\n    should produce a number ... ok (1ms)\n    should be between 0 and 1 ... ok (1ms)\n  prng ... ok (4ms)\n  incremenet base32 ...\n    increments correctly ... ok (0ms)\n    carries correctly ... ok (0ms)\n    double increments correctly ... ok (0ms)\n    throws when it cannot increment ... ok (0ms)\n  incremenet base32 ... ok (2ms)\n  randomChar ...\n    should never return undefined ... ok (0ms)\n    should never return an empty string ... ok (0ms)\n  randomChar ... ok (153ms)\n  encodeTime ...\n    should return expected encoded result ... ok (0ms)\n    should change length properly ... ok (0ms)\n    should truncate time if not enough length ... ok (0ms)\n    should throw an error ...\n      if time greater than (2 ^ 48) - 1 ... ok (0ms)\n      if time is not a number ... ok (0ms)\n      if time is infinity ... ok (0ms)\n      if time is negative ... ok (1ms)\n      if time is a float ... ok (0ms)\n    should throw an error ... ok (3ms)\n  encodeTime ... ok (8ms)\n  encodeRandom ...\n    should return correct length ... ok (0ms)\n  encodeRandom ... ok (0ms)\n  decodeTime ...\n    should return correct timestamp ... ok (0ms)\n    should accept the maximum allowed timestamp ... ok (0ms)\n    should reject ...\n      malformed strings of incorrect length ... ok (0ms)\n      strings with timestamps that are too high ... ok (0ms)\n      invalid character ... ok (0ms)\n    should reject ... ok (1ms)\n  decodeTime ... ok (1ms)\n  ulid ...\n    should return correct length ... ok (0ms)\n    should return expected encoded time component result ... ok (0ms)\n  ulid ... ok (0ms)\n  monotonicity ...\n    without seedTime ...\n      first call ... ok (0ms)\n      second call ... ok (0ms)\n      third call ... ok (0ms)\n      fourth call ... ok (0ms)\n    without seedTime ... ok (1ms)\n    with seedTime ...\n      first call ... ok (0ms)\n      second call with the same ... ok (0ms)\n      third call with less than ... ok (0ms)\n      fourth call with even more less than ... ok (0ms)\n      fifth call with 1 greater than ... ok (0ms)\n    with seedTime ... ok (2ms)\n  monotonicity ... ok (5ms)\nulid ... ok (181ms)\n\nok | 1 passed (45 steps) | 0 failed (183ms)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffajarnugraha37%2Fdeno-ulid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffajarnugraha37%2Fdeno-ulid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffajarnugraha37%2Fdeno-ulid/lists"}