UUIDSchemaclass

new UUIDSchema({ one = "UUID", title = "UUID", max = 36, ...rest }: UUIDSchemaOptions = {})
ParamType
restUUIDSchemaOptions
Options for a UUIDSchema. Defaults to {}
    .valuestring
Default string value used when the input is undefined. readonly
    .maxnumber
Maximum allowed character length. Defaults to 36 readonly
    .case"upper"
"lower"
Force the result to "upper" or "lower" case. readonly
    .inputStringInputType
HTML <input /> type="" hint for downstream UIs. readonly
Return
UUIDSchema
Schema that defines a valid UUID string (versions 1-5). Defaults to any-version validation.

Schema that defines a valid UUID string (versions 1-5). Defaults to any-version validation.

  • Input is trimmed and lowercased.
  • Falsy values are converted to an empty string.

Examples

const schema = new UUIDSchema({});
	schema.validate("F47AC10B-58CC-4372-A567-0E02B2C3D479") // "f47ac10b-58cc-4372-a567-0e02b2c3d479"