Skip to content

Commit

Permalink
fix(types): Swapped minLength and maxLength arguments of the StringTy…
Browse files Browse the repository at this point in the history
…pe constructor

BREAKING_CHANGE: StringType
  • Loading branch information
CheerlessCloud committed May 30, 2017
1 parent 69d1a27 commit 5854237
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/types/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 5854237

Please sign in to comment.