validata
Version:
Type safe data validation and sanitization
25 lines (24 loc) • 784 B
TypeScript
export type StringFormatCheck = (value: string) => true | FormatIssue;
export interface FormatIssue {
expectedFormat: string;
[key: string]: unknown;
}
export declare const REGEX_ULID: RegExp;
export declare const REGEX_UUID: RegExp;
interface PasswordRequirements {
minLength?: number;
numberChars?: number;
lowerCaseChars?: number;
upperCaseChars?: number;
specialChars?: number;
}
interface CheckEmailOptions {
allowDisplayName?: boolean;
}
export declare namespace StringFormat {
const email: (options?: CheckEmailOptions | undefined) => StringFormatCheck;
const password: (requirements?: PasswordRequirements | undefined) => StringFormatCheck;
const ULID: () => StringFormatCheck;
const UUID: () => StringFormatCheck;
}
export {};