Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
});
truly = checked;
break;
default:
truly = !!ele.val();
}
// 非必要且没有值的时候, 直接 callback
if (!truly) {
callback && callback(null, null);
return;
}
}
if (!$.isArray(rules))
throw new Error('No validation rule specified or not specified as an array.');
var tasks = [];
$.each(rules, function (i, item) {
var obj = utils.parseRule(item),
ruleName = obj.name,
param = obj.param;
var ruleOperator = Rule.getOperator(ruleName);
if (!ruleOperator)
throw new Error('Validation rule with name "' + ruleName + '" cannot be found.');
var options = getMsgOptions(param, ruleName, self);
tasks.push(function (cb) {
$.each(name, function (i, v) {
if ($.isArray(v))
addRule(i, v[0], v[1]);
else
addRule(i, v);
});
return this;