decoval
Version:
DecoVal is a decorator-driven validation pattern that allows you to add validation rules directly to the properties of TypeScript classes, simplifying data control and increasing code readability and reusability.
13 lines (12 loc) • 331 B
TypeScript
export type DvIdTypes = "uuid" | "mongo" | "number";
export interface DvIdOptions {
type?: DvIdTypes;
optional?: boolean;
null?: boolean;
empty?: boolean;
regex?: string | RegExp | {
value: string | RegExp;
message?: string;
};
}
export declare const ID_PATTERNS: Record<DvIdTypes, RegExp>;