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

Function string

_benchmarks/sample_antd.js:75193–75216  ·  view source on GitHub ↗

* Performs validation for string types. * * @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

(rule, value, callback, source, options)

Source from the content-addressed store, hash-verified

75191 */
75192
75193function string(rule, value, callback, source, options) {
75194 var errors = [];
75195 var validate = rule.required || !rule.required && source.hasOwnProperty(rule.field);
75196
75197 if (validate) {
75198 if (isEmptyValue(value, 'string') && !rule.required) {
75199 return callback();
75200 }
75201
75202 rules.required(rule, value, source, errors, options, 'string');
75203
75204 if (!isEmptyValue(value, 'string')) {
75205 rules.type(rule, value, source, errors, options);
75206 rules.range(rule, value, source, errors, options);
75207 rules.pattern(rule, value, source, errors, options);
75208
75209 if (rule.whitespace === true) {
75210 rules.whitespace(rule, value, source, errors, options);
75211 }
75212 }
75213 }
75214
75215 callback(errors);
75216}
75217
75218/**
75219 * Validates a function.

Callers 15

TestMediatypeFunction · 0.50
TestDataURIFunction · 0.50
TestDecimalFunction · 0.50
TestDecimalTruncateFunction · 0.50
TestNumberFunction · 0.50
TestNumberTruncateFunction · 0.50
TestDecimalRandomFunction · 0.50
TestNumberRandomFunction · 0.50
DataURIFunction · 0.50
MatchMethod · 0.50
MinifyMimetypeMethod · 0.50
StringMethod · 0.50

Calls 2

isEmptyValueFunction · 0.70
callbackFunction · 0.70

Tested by 14

TestMediatypeFunction · 0.40
TestDataURIFunction · 0.40
TestDecimalFunction · 0.40
TestDecimalTruncateFunction · 0.40
TestNumberFunction · 0.40
TestNumberTruncateFunction · 0.40
TestDecimalRandomFunction · 0.40
TestNumberRandomFunction · 0.40
TestRenamerIndicesFunction · 0.40
TestSpecialTagClosingFunction · 0.40
TestBufferFunction · 0.40
TestPathDataFunction · 0.40

Used in the wild real call sites across dependent graphs

searching dependent graphs…