* Validates a number is an integer. * * @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 options.mes
(rule, value, callback, source, options)
| 75352 | */ |
| 75353 | |
| 75354 | function integer(rule, value, callback, source, options) { |
| 75355 | var errors = []; |
| 75356 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); |
| 75357 | |
| 75358 | if (validate) { |
| 75359 | if (isEmptyValue(value) && !rule.required) { |
| 75360 | return callback(); |
| 75361 | } |
| 75362 | |
| 75363 | rules.required(rule, value, source, errors, options); |
| 75364 | |
| 75365 | if (value !== undefined) { |
| 75366 | rules.type(rule, value, source, errors, options); |
| 75367 | rules.range(rule, value, source, errors, options); |
| 75368 | } |
| 75369 | } |
| 75370 | |
| 75371 | callback(errors); |
| 75372 | } |
| 75373 | |
| 75374 | /** |
| 75375 | * Validates a number is a floating point number. |
nothing calls this directly
no test coverage detected
searching dependent graphs…