Error en validación length solucionado
This commit is contained in:
parent
a73b2eba0d
commit
d3ef7dde86
|
@ -15,15 +15,16 @@ export const validators = {
|
|||
max: conf.max || conf.is
|
||||
};
|
||||
if (!validator.isLength(value, options)) {
|
||||
if (conf.is || conf.min === conf.max)
|
||||
if (conf.is) {
|
||||
throw new Error(`Value should be ${conf.is} characters long`);
|
||||
else if (conf.min !== conf.max)
|
||||
} else if (conf.min && conf.max) {
|
||||
throw new Error(`Value should have a length between ${conf.min} and ${conf.max}`);
|
||||
else if (conf.min)
|
||||
} else if (conf.min) {
|
||||
throw new Error(`Value should have at least ${conf.min} characters`);
|
||||
else
|
||||
} else {
|
||||
throw new Error(`Value should have at most ${conf.min} characters`);
|
||||
}
|
||||
}
|
||||
},
|
||||
numericality: function(value, conf) {
|
||||
if (conf.int) {
|
||||
|
|
Loading…
Reference in New Issue