PasswordSchemaclass
new PasswordSchema({ one = "password", title = "Password", min = 6, input = "password", ...options }: StringSchemaOptions = {})| Param | Type | |
|---|---|---|
options | StringSchemaOptions | Options for StringSchema. Defaults to {} |
.value | string | Default string value used when the input is undefined. Defaults to "" readonly |
.min | number | Minimum allowed character length. Defaults to 0 readonly |
.max | number | Maximum allowed character length. Defaults to Number.POSITIVE_INFINITY readonly |
.rows | number | Number of rows; more than one enables multiline sanitization. Defaults to 1 readonly |
.match | RegExp | Regular expression the sanitized string must match. readonly |
.case | "upper""lower" | Force the result to "upper" or "lower" case. readonly |
.input | StringInputType | 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). - Never formats the value for display (
format()always returns"").
Examples
new PasswordSchema({}).validate("hunter2"); // Returns "hunter2"