variable monotonicUlid
Generate a monotonically increasing ULID, optionally based on a given timestamp.
Examples
Example 1
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