{"id":15662058,"url":"https://github.com/kt3k/ulid","last_synced_at":"2025-07-19T13:37:52.607Z","repository":{"id":173344900,"uuid":"649497450","full_name":"kt3k/ulid","owner":"kt3k","description":"ULID for Deno, a UUID alternative that is lexically ordered by generation time","archived":false,"fork":false,"pushed_at":"2023-08-22T12:14:25.000Z","size":33,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-05T23:08:13.309Z","etag":null,"topics":["deno","ulid"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kt3k.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}},"created_at":"2023-06-05T02:16:46.000Z","updated_at":"2024-01-22T21:21:37.000Z","dependencies_parsed_at":"2023-09-26T16:47:18.893Z","dependency_job_id":null,"html_url":"https://github.com/kt3k/ulid","commit_stats":null,"previous_names":["kt3k/ulid"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Fulid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Fulid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Fulid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kt3k%2Fulid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kt3k","download_url":"https://codeload.github.com/kt3k/ulid/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252590610,"owners_count":21772937,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["deno","ulid"],"created_at":"2024-10-03T13:29:57.713Z","updated_at":"2025-05-05T23:08:19.125Z","avatar_url":"https://github.com/kt3k.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e\n  \u003cimg width=\"180\" src=\"logo.png\" alt=\"ulid\"\u003e\n\u003c/h1\u003e\n\n# [ULID](https://github.com/ulid/spec) for [Deno](https://deno.com/runtime)\n\n[![ci](https://github.com/kt3k/ulid/actions/workflows/ci.yml/badge.svg)](https://github.com/kt3k/ulid/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/kt3k/ulid/branch/main/graph/badge.svg?token=okdKJphcWc)](https://codecov.io/gh/kt3k/ulid)\n\nULID is an alternative to UUID with the following features:\n\n- 128-bit compatibility with UUID\n- 1.21e+24 unique ULIDs per millisecond\n- Lexicographically sortable!\n- Canonically encoded as a 26 character string, as opposed to the 36 character\n  UUID\n- Uses Crockford's base32 for better efficiency and readability (5 bits per\n  character)\n- Case insensitive\n- No special characters (URL safe)\n- Monotonic sort order (correctly detects and handles the same millisecond)\n\n## Import\n\n```js\nimport { ulid } from \"https://deno.land/x/ulid@v0.3.0/mod.ts\";\n```\n\n## Usage\n\nTo generate a ULID, simply run the function:\n\n```js\nimport { ulid } from \"https://deno.land/x/ulid@v0.3.0/mod.ts\";\n\nulid(); // 01ARZ3NDEKTSV4RRFFQ69G5FAV\n```\n\n### Seed Time\n\nYou can also input a seed time which will consistently give you the same string\nfor the time component. This is useful for migrating to ulid.\n\n```js\nulid(1469918176385); // 01ARYZ6S41TSV4RRFFQ69G5FAV\n```\n\n### Monotonic ULIDs\n\nTo generate monotonically increasing ULIDs, create a monotonic counter.\n\n_Note that the same seed time is being passed in for this example to demonstrate\nits behaviour when generating multiple ULIDs within the same millisecond_\n\n```js\nimport { monotonicFactory } from \"https://deno.land/x/ulid@v0.3.0/mod.ts\";\n\nconst ulid = monotonicFactory();\n\n// Strict ordering for the same timestamp, by incrementing the least-significant random bit by 1\nulid(150000); // 000XAL6S41ACTAV9WEVGEMMVR8\nulid(150000); // 000XAL6S41ACTAV9WEVGEMMVR9\nulid(150000); // 000XAL6S41ACTAV9WEVGEMMVRA\nulid(150000); // 000XAL6S41ACTAV9WEVGEMMVRB\nulid(150000); // 000XAL6S41ACTAV9WEVGEMMVRC\n\n// Even if a lower timestamp is passed (or generated), it will preserve sort order\nulid(100000); // 000XAL6S41ACTAV9WEVGEMMVRD\n```\n\n#### Use your own PRNG\n\nTo use your own pseudo-random number generator, import the factory, and pass it\nyour generator function.\n\n```js\nimport { factory } from \"https://deno.land/x/ulid@v0.3.0/mod.ts\";\nimport prng from \"somewhere\";\n\nconst ulid = factory(prng);\n\nulid(); // 01BXAVRG61YJ5YSBRM51702F6M\n```\n\nYou can also pass in a `prng` to the `monotonicFactory` function.\n\n```js\nimport { monotonicFactory } from \"https://deno.land/x/ulid@v0.3.0/mod.ts\";\nimport prng from \"somewhere\";\n\nconst ulid = monotonicFactory(prng);\n\nulid(); // 01BXAVRG61YJ5YSBRM51702F6M\n```\n\n## Implementations in other languages\n\nRefer to [ulid/spec](https://github.com/ulid/spec)\n\n## Specification\n\nRefer to [ulid/spec](https://github.com/ulid/spec)\n\n## Test Suite\n\n```sh\ndeno test\n```\n\n## Performance\n\n```sh\ndeno bench\n```\n\n```\ncpu: Apple M1\nruntime: deno 1.34.1 (aarch64-apple-darwin)\n\nfile:///Users/kt3k/oss/ulid/bench.ts\nbenchmark         time (avg)             (min … max)       p75       p99      p995\n---------------------------------------------------- -----------------------------\nencodeTime    378.13 ns/iter(324.22 ns … 432.38 ns) 387.6 ns 418.98 ns 432.38 ns\nencodeRandom  1.72 µs/iter(1.68 µs … 1.79 µs) 1.74 µs 1.79 µs 1.79 µs\ngenerate      3.08 µs/iter(3.03 µs … 3.32 µs) 3.07 µs 3.32 µs 3.32 µs\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkt3k%2Fulid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkt3k%2Fulid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkt3k%2Fulid/lists"}