simple-body-validator
Version:
This package is inspired by Laravel validation, and aims to make body validation easier for Javascript developers
91 lines (90 loc) • 2.78 kB
TypeScript
import { InitialRule } from '../types';
import Validator from '../validator';
import RuleContract from './ruleContract';
declare class Password extends RuleContract {
/**
* The validator performing the validation.
*/
private validator;
/**
* The minimum size of the password.
*/
private minLength;
/**
* The min amount of lower case letters required in the password
*/
private minLowerCase;
/**
* The min amount of uppercase letters required in the password
*/
private minUpperCase;
/**
* The min amount of letters required in the password
*/
private minLetters;
/**
* The min amount of letters required in the password
*/
private minNumbers;
/**
* The min amount of symbols required in the password
*/
private minSymbols;
/**
* Additional validation rules that should be merged into the default rules during validation.
*/
private customRules;
/**
* The callback that will generate the "default" version of the password rule.
*/
static defaultCallback: Function | Password;
/**
* Create a new instance of the password class
*/
static create(): Password;
/**
* Set the minimum length of the password
*/
min(min: number): Password;
/**
* Set the min amount of letters required in the password
*/
letters(letters?: number): Password;
/**
* Set the min amount of upper and lower case letters required in the password
*/
mixedCase(upperCase?: number, lowerCase?: number): Password;
/**
* Set the min amount of numbers required in the password
*/
numbers(numbers?: number): Password;
/**
* Set the min amount of symbols required in the password
*/
symbols(symbols?: number): Password;
/**
* Determine if the validation rule passes.
*/
passes(value: any, attribute: string): boolean;
/**
* Specify additional validation rules that should be merged with the default rules during validation.
*/
rules(rules: InitialRule[]): Password;
/**
* Get all the validation error messages related to the password
*/
getMessage(): object;
/**
* Set the validator instance used to validate the password
*/
setValidator(validator: Validator): Password;
/**
* Set the default callback to be used for determining a password's default rules.
*/
static setDefault(callback?: Function | Password): void;
/**
* Get the default configuration of the password rule.
*/
static default(): RuleContract | Password;
}
export default Password;