* Validates the regular expression type. * * @param rule The validation rule. * @param value The value of the field on the source object. * @param callback The callback function. * @param source The source object being validated. * @param options The validation options. * @param option
(rule, value, callback, source, options)
| 75322 | */ |
| 75323 | |
| 75324 | function regexp(rule, value, callback, source, options) { |
| 75325 | var errors = []; |
| 75326 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); |
| 75327 | |
| 75328 | if (validate) { |
| 75329 | if (isEmptyValue(value) && !rule.required) { |
| 75330 | return callback(); |
| 75331 | } |
| 75332 | |
| 75333 | rules.required(rule, value, source, errors, options); |
| 75334 | |
| 75335 | if (!isEmptyValue(value)) { |
| 75336 | rules.type(rule, value, source, errors, options); |
| 75337 | } |
| 75338 | } |
| 75339 | |
| 75340 | callback(errors); |
| 75341 | } |
| 75342 | |
| 75343 | /** |
| 75344 | * Validates a number is an integer. |
nothing calls this directly
no test coverage detected
searching dependent graphs…