sure-guard
Version:
Node library for data validation
45 lines (44 loc) • 1.35 kB
TypeScript
/**
* Class for validating strings.
*/
export declare class StringValidator {
private readonly value;
private isValid;
/**
* Creates a new StringValidator instance.
* @param {any} value - The value to be validated.
*/
constructor(value: any);
/**
* Checks if the value is of type string.
* @returns {this} - The StringValidator instance.
*/
isString(): this;
/**
* Checks if the string size is less than or equal to a maximum.
* @param {number} maxSize - The maximum value allowed.
* @returns {this} - The StringValidator instance.
*/
isMaxSize(maxSize: number): this;
/**
* Checks if the string size is greater than or equal to a minimum.
* @param {number} minSize - The minimum value allowed.
* @returns {this} - The StringValidator instance.
*/
isMinSize(minSize: number): this;
/**
* Checks if the string is a valid email address.
* @returns {this} - The StringValidator instance.
*/
isEmail(): this;
/**
* Checks if the string contains only alphanumeric characters.
* @returns {this} - The StringValidator instance.
*/
isAlphanumeric(): this;
/**
* Returns the result of the validation.
* @returns {boolean} - The result of the validation.
*/
getResult(): boolean;
}