Skip to content

Function: notIn()

ts
function notIn<T>(values): Validator<T>;

Enum exclusion validation / 枚举排除校验

Type Parameters

Type Parameter
T

Parameters

ParameterType
valuesreadonly T[]

Returns

Validator<T>

Example

ts
notIn(['admin', 'root'])('user') // => { isValid: true, message: undefined }
notIn(['admin', 'root'])('admin') // => { isValid: false, message: 'Value is in the blocked list / 值在禁止的列表中' }

Since

1.0.0

Released under the MIT License.