PasswordSchemaclass

new PasswordSchema({ one = "password", title = "Password", min = 6, input = "password", ...options }: StringSchemaOptions = {})
ParamType
optionsStringSchemaOptions
Options for StringSchema. Defaults to {}
    .valuestring
Default string value used when the input is undefined. Defaults to "" readonly
    .minnumber
Minimum allowed character length. Defaults to 0 readonly
    .maxnumber
Maximum allowed character length. Defaults to Number.POSITIVE_INFINITY readonly
    .multilineboolean
Whether the string keeps line breaks (multiline sanitization). An input for it is a <textarea> that grows. Defaults to false readonly
    .rowsnumber
Rows a multiline input shows at first. Set 1 for a box that starts one line high, like a chat message. Single-line inputs ignore it. Defaults to `2` when `multiline`, else `1` readonly
    .matchRegExp
Regular expression the sanitized string must match. readonly
    .case"upper"
"lower"
Force the result to "upper" or "lower" case. readonly
    .inputStringInputType
HTML <input /> type="" hint for downstream UIs. Defaults to "text" readonly
Return
PasswordSchema
Schema that defines a valid password string.

Schema that defines a valid password string.

  • Defaults the <input /> hint to "password", but a caller can override it (e.g. "text" for a show-password toggle).
  • Formats the value unchanged (like StringSchema) so a password <input /> can hold and mask it — hiding the value is the input's job, not the schema's.

Examples

new PasswordSchema({}).validate("hunter2"); // Returns "hunter2"