Skip to main content

@std/ulid@0.215.0

latest
Works with
It is unknown whether this package works with Browsers, Deno, Node.js, Cloudflare Workers, Bun
It is unknown whether this package works with Browsers
It is unknown whether this package works with Deno
It is unknown whether this package works with Node.js
It is unknown whether this package works with Cloudflare Workers
It is unknown whether this package works with Bun
JSR Score76%
Published2 years ago (0.215.0)
variable monotonicUlid

Generate a monotonically increasing ULID, optionally based on a given timestamp.

Examples

Example 1

import { monotonicUlid } from "@std/ulid";

// Strict ordering for the same timestamp, by incrementing the least-significant random bit by 1
monotonicUlid(150000); // 000XAL6S41ACTAV9WEVGEMMVR8
monotonicUlid(150000); // 000XAL6S41ACTAV9WEVGEMMVR9
monotonicUlid(150000); // 000XAL6S41ACTAV9WEVGEMMVRA
monotonicUlid(150000); // 000XAL6S41ACTAV9WEVGEMMVRB
monotonicUlid(150000); // 000XAL6S41ACTAV9WEVGEMMVRC

// Even if a lower timestamp is passed (or generated), it will preserve sort order
monotonicUlid(100000); // 000XAL6S41ACTAV9WEVGEMMVRD

Type

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@std/ulid

Import symbol

import { monotonicUlid } from "@std/ulid";
or

Import directly with a jsr specifier

import { monotonicUlid } from "jsr:@std/ulid";