Skip to content

createTimestampId

createTimestampId<Brand>(brand, opts?): TimestampCodec<Brand>

Defined in: src/codecs/timestamp/index.ts:116

Creates a codec for brand (three lowercase a–z characters).

Brand extends string

Brand & ValidBrand<Brand>

Entity type brand validated once at construction.

TimestampOptions = {}

Optional now, rng, and allowDuplicateBrand overrides.

TimestampCodec<Brand>

const users = createTimestampId("usr");
const id = users.generate(); // Id<"usr">
users.extractTimestamp(id); // Date