From 5854237c24c20400028289bc774d5e8d9e992b80 Mon Sep 17 00:00:00 2001 From: EnRoute Date: Tue, 30 May 2017 13:11:23 +0300 Subject: [PATCH] fix(types): Swapped minLength and maxLength arguments of the StringType constructor BREAKING_CHANGE: StringType --- src/types/string.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/types/string.js b/src/types/string.js index f12bd7d..b4a1a0c 100644 --- a/src/types/string.js +++ b/src/types/string.js @@ -3,21 +3,21 @@ import ConfigFieldBaseType from './base'; class StringType extends ConfigFieldBaseType { /** * String type - * @param {number=} minLength * @param {number=} maxLength + * @param {number=} minLength * @param {string[]=} allowed */ - constructor(minLength, maxLength, allowed) { + constructor(maxLength, minLength, allowed) { super(); this.validators.push(val => typeof val === 'string'); if (minLength !== null && minLength !== undefined) { - this.validators.push(val => val.length > minLength); + this.validators.push(val => val.length >= minLength); } if (maxLength !== null && maxLength !== undefined) { - this.validators.push(val => val.length < maxLength); + this.validators.push(val => val.length <= maxLength); } if (allowed && allowed.length) {