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

Function method

_benchmarks/sample_antd.js:75229–75246  ·  view source on GitHub ↗

* Validates a function. * * @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.messages The va

(rule, value, callback, source, options)

Source from the content-addressed store, hash-verified

75227 */
75228
75229function method(rule, value, callback, source, options) {
75230 var errors = [];
75231 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
75232
75233 if (validate) {
75234 if (isEmptyValue(value) && !rule.required) {
75235 return callback();
75236 }
75237
75238 rules.required(rule, value, source, errors, options);
75239
75240 if (value !== undefined) {
75241 rules.type(rule, value, source, errors, options);
75242 }
75243 }
75244
75245 callback(errors);
75246}
75247
75248/**
75249 * Validates a number.

Callers 2

callFunction · 0.85
createCoordSysRecordFunction · 0.85

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…