Applied Coobaha's PR fix - prevents undefined values

This commit is contained in:
Fabien Franzen 2014-08-26 17:15:07 +02:00
parent bed97a75cb
commit 73330113ae
1 changed files with 5 additions and 2 deletions

View File

@ -383,7 +383,9 @@ var validators = {
function getConfigurator(name, opts) { function getConfigurator(name, opts) {
return function () { return function () {
configure(this, name, arguments, opts); var args = Array.prototype.slice.call(arguments);
args[1] = args[1] || {};
configure(this, name, args, opts);
}; };
} }
@ -649,7 +651,8 @@ function configure(cls, validation, args, opts) {
} }
conf.validation = validation; conf.validation = validation;
args.forEach(function (attr) { args.forEach(function (attr) {
cls._validations.push([attr, conf, opts]); var validation = opts ? [attr, conf, opts] : [attr, conf];
cls._validations.push(validation);
}); });
} }