UNPKG

valibot-schema-ulid

Version:

Valibot schema for Universally Unique Lexicographically Sortable Identifiers (ULID)

21 lines (17 loc) 779 B
import { CustomIssue, CustomSchema, ErrorMessage, InferOutput } from 'valibot'; /** * A schema for validating r Universally Unique Lexicographically Sortable Identifiers {@see {@link https://github.com/ulid/spec}}. * @module */ /** * Function to validate ULIDs. * @param overrideMessage - A string to override the default message or a callback to define a custom message function. * @returns A custom schema for ULID validation. */ declare const ulid: (overrideMessage?: string | ((value: CustomIssue) => string)) => CustomSchema<string, ErrorMessage<CustomIssue>>; /** * Type for the output of the ULID schema. * @typedef {InferOutput<ReturnType<typeof ulid>>} UlidSchema */ type UlidSchema = InferOutput<ReturnType<typeof ulid>>; export { type UlidSchema, ulid };