ajt-validator
Version:
Validation library for JavaScript and TypeScript
27 lines (26 loc) • 830 B
TypeScript
import { BaseValidator } from "../base";
import { ValidationResult } from "../../interfaces";
export interface AddressValidatorOptions {
streetRequired?: boolean;
cityRequired?: boolean;
stateRequired?: boolean;
postalCodeRequired?: boolean;
countryRequired?: boolean;
maxStreetLength?: number;
maxCityLength?: number;
maxStateLength?: number;
postalCodePattern?: RegExp;
}
export interface AddressData {
street?: string;
city?: string;
state?: string;
postalCode?: string;
country?: string;
}
export type AddressValidationResult = ValidationResult<AddressData>;
export declare class AddressValidator extends BaseValidator<AddressData> {
private options;
constructor(options?: AddressValidatorOptions);
validate(address: AddressData): AddressValidationResult;
}