first commit
This commit is contained in:
19
frontend/node_modules/@rc-component/async-validator/es/rule/whitespace.js
generated
vendored
Normal file
19
frontend/node_modules/@rc-component/async-validator/es/rule/whitespace.js
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
import { format } from "../util";
|
||||
|
||||
/**
|
||||
* Rule for validating whitespace.
|
||||
*
|
||||
* @param rule The validation rule.
|
||||
* @param value The value of the field on the source object.
|
||||
* @param source The source object being validated.
|
||||
* @param errors An array of errors that this rule may add
|
||||
* validation errors to.
|
||||
* @param options The validation options.
|
||||
* @param options.messages The validation messages.
|
||||
*/
|
||||
var whitespace = function whitespace(rule, value, source, errors, options) {
|
||||
if (/^\s+$/.test(value) || value === '') {
|
||||
errors.push(format(options.messages.whitespace, rule.fullField));
|
||||
}
|
||||
};
|
||||
export default whitespace;
|
||||
Reference in New Issue
Block a user