diff --git a/client/core/src/lib/validator.js b/client/core/src/lib/validator.js index 3da350a3e..75ebd2e47 100644 --- a/client/core/src/lib/validator.js +++ b/client/core/src/lib/validator.js @@ -15,14 +15,15 @@ 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) {