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

Function integer

_benchmarks/sample_antd.js:75354–75372  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

75352 */
75353
75354function 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.

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…