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

Function regexp

_benchmarks/sample_antd.js:75324–75341  ·  view source on GitHub ↗

* Validates the regular expression type. * * @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 option

(rule, value, callback, source, options)

Source from the content-addressed store, hash-verified

75322 */
75323
75324function regexp(rule, value, callback, source, options) {
75325 var errors = [];
75326 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
75327
75328 if (validate) {
75329 if (isEmptyValue(value) && !rule.required) {
75330 return callback();
75331 }
75332
75333 rules.required(rule, value, source, errors, options);
75334
75335 if (!isEmptyValue(value)) {
75336 rules.type(rule, value, source, errors, options);
75337 }
75338 }
75339
75340 callback(errors);
75341}
75342
75343/**
75344 * Validates a number is an integer.

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…