24 lines
773 B
JavaScript
24 lines
773 B
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = void 0;
|
|
var _util = require("../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((0, _util.format)(options.messages.whitespace, rule.fullField));
|
|
}
|
|
};
|
|
var _default = exports.default = whitespace; |