* Validates a number is a floating point number. * * @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. * @para
(rule, value, callback, source, options)
| 75383 | */ |
| 75384 | |
| 75385 | function floatFn(rule, value, callback, source, options) { |
| 75386 | var errors = []; |
| 75387 | var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field); |
| 75388 | |
| 75389 | if (validate) { |
| 75390 | if (isEmptyValue(value) && !rule.required) { |
| 75391 | return callback(); |
| 75392 | } |
| 75393 | |
| 75394 | rules.required(rule, value, source, errors, options); |
| 75395 | |
| 75396 | if (value !== undefined) { |
| 75397 | rules.type(rule, value, source, errors, options); |
| 75398 | rules.range(rule, value, source, errors, options); |
| 75399 | } |
| 75400 | } |
| 75401 | |
| 75402 | callback(errors); |
| 75403 | } |
| 75404 | |
| 75405 | /** |
| 75406 | * Validates an array. |
nothing calls this directly
no test coverage detected
searching dependent graphs…