UNPKG

altheia-async-data-validator

Version:

A very simple, fast and customizable async data validator

84 lines (83 loc) 1.79 kB
import { TypeBase } from './base'; import { LangList } from '../types/lang'; export declare const messages: LangList; /** * String class */ export declare class TypeString extends TypeBase { /** * Constructor */ constructor(); _cast(): void; /** * Test to validate the type of the value * * @return {this} */ typeof(): this; /** * Force a string to be not empty * * @return {this} */ noEmpty(): this; /** * Force a string to be equal or more to the value passed. * * @param {number} min * @return {this} */ min(min: number): this; /** * Force a string to be equal or less to the value passed. * * @param {number} max * @return {this} */ max(max: number): this; /** * Force a string to match the regex passed. * * @param {Regex} regex * @return {this} */ pattern(regex: RegExp): this; /** * Force a string to be equal to one of the value passed in the set. * * @param {...string} obj * @return {this} */ in(...obj: string[]): this; /** * Force a string to be different to all of the value passed in the set. * * @param {...string} obj * @return {this} */ not(...obj: string[]): this; /** * Force a string to be a valid email (contain an @). * * @return {this} */ email(): this; /** * Force a string to be fully in lowercase. * * @return {this} */ lowercase(): this; /** * Force a string to be fully in uppercase. * * @return {this} */ uppercase(): this; } declare const def: { Class: typeof TypeString; messages: LangList; }; export default def;