MCPcopy
hub / github.com/tdewolff/minify / floatFn

Function floatFn

_benchmarks/sample_antd.js:75385–75403  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

75383 */
75384
75385function 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.

Callers

nothing calls this directly

Calls 2

isEmptyValueFunction · 0.70
callbackFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…