Home Reference Source

src/validator/rules/MinLength.js

import Rule from './Rule';

export default class MinLength extends Rule {
  defaultMessage = '{{field}} must have no more than {{- settings.length}} characters.';

  check(value) {
    const minLength = parseInt(this.settings.length, 10);
    if (!minLength || !value || !value.hasOwnProperty('length') || this.component.isEmpty(value)) {
      return true;
    }
    return (value.length >= minLength);
  }
}