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

Function object

_benchmarks/sample_antd.js:75447–75464  ·  view source on GitHub ↗

* Validates an object. * * @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 val

(rule, value, callback, source, options)

Source from the content-addressed store, hash-verified

75445 */
75446
75447function object(rule, value, callback, source, options) {
75448 var errors = [];
75449 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
75450
75451 if (validate) {
75452 if (isEmptyValue(value) && !rule.required) {
75453 return callback();
75454 }
75455
75456 rules.required(rule, value, source, errors, options);
75457
75458 if (value !== undefined) {
75459 rules.type(rule, value, source, errors, options);
75460 }
75461 }
75462
75463 callback(errors);
75464}
75465
75466var ENUM$1 = 'enum';
75467/**

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…