Skip to content

Function: maxLength() ​

ts
function maxLength(max): Validator<string>;

Maximum length validation / 最大长度验证

Parameters ​

ParameterType
maxnumber

Returns ​

Validator<string>

Example ​

ts
maxLength(5)('toolong') // => { isValid: false, message: 'Maximum length is 5 characters / 最大长度为5个字符' }
maxLength(5)('ok') // => { isValid: true, message: undefined }

Since ​

1.0.0

Released under the MIT License.