UlidApi
Defined in: src/ulid.ts:124
ulid() makes one; ulid.timestamp() reads the time back out.
Lexicographic order matches time order, which is what makes a ULID sort correctly as a plain string in a database index.
Example
Section titled “Example”const id = ulid(); // "01K39XQZP4W8YHN2VBTKD7A3RM"ulid.timestamp(id); // 1756890764019, the millisecond it was made
// Two made in the same millisecond still sort in creation order.ulid() < ulid(); // trueUlidApi(
options?):string
Defined in: src/ulid.ts:125
ulid() makes one; ulid.timestamp() reads the time back out.
Lexicographic order matches time order, which is what makes a ULID sort correctly as a plain string in a database index.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”string
Example
Section titled “Example”const id = ulid(); // "01K39XQZP4W8YHN2VBTKD7A3RM"ulid.timestamp(id); // 1756890764019, the millisecond it was made
// Two made in the same millisecond still sort in creation order.ulid() < ulid(); // trueProperties
Section titled “Properties”timestamp
Section titled “timestamp”timestamp: (
value) =>number
Defined in: src/ulid.ts:126
The generation time of a ULID, in Unix milliseconds.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”number