vue-forms-builder
Version:
Typescript forms builder package written specifically for Vue
66 lines (65 loc) • 2.58 kB
TypeScript
import { ValidationError, ValidatorFunction } from '../models';
export declare class Validators {
/**
* Requires the control's value to be non-empty
* @returns null if control's value meets the
* requirements, if not returns an error object with
* required property as true
*/
static required: (value: any) => ValidationError | null;
/**
* Requires the control's value to be true
* @returns null if control's value meets the
* requirements, if not returns an error object with
* required property as true
*/
static requiredTrue: (value: any) => ValidationError | null;
/**
* Requires the control's value to match a regex pattern
* @param pattern - provided regex pattern
* @returns null if control's value meets the
* requirements, if not returns an error object with
* pattern property as true
*/
static pattern: (regex: RegExp) => ValidatorFunction;
/**
* Requires the control's value to be greater than or equal to the provided number.
* @param min - provided min number
* @returns null if control's value meets the
* requirements, if not returns an error object with min
* property as true
*/
static min: (minValue: number) => ValidatorFunction;
/**
* Requires the control's value to be less than or equal to the provided number.
* @param max - provided max number
* @returns null if control's value meets the
* requirements, if not returns an error object with max
* property as true
*/
static max: (maxValue: number) => ValidatorFunction;
/**
* Requires the length of the control's value to be
* greater than or equal to the provided minimum length
* @param minLength - provided minimum length
* @returns null if control's value meets the
* requirements, if not returns an error object with
* minLength property as true
*/
static minLength: (minLengthValue: number) => ValidatorFunction;
/**
* Requires the length of the control's value to be
* less than or equal to the provided maximum length
* @param maxLength - provided maximum length
* @returns null if control's value meets the
* requirements, if not returns an error object with
* maxLength property as true
*/
static maxLength: (maxLengthValue: number) => ValidatorFunction;
/**
* Checks if value is empty
* @param value - value to check
* @returns if is empty returns true, if not returns false
*/
private static _isEmpty;
}