file-validation-engine
Version:
A dynamic rule-based validation engine for Excel and CSV files
22 lines (21 loc) • 594 B
TypeScript
export type Rule = {
column: string;
validate: (value: any, row: any) => boolean;
errorMessage: string;
condition?: (row: any) => boolean;
unique?: boolean;
};
export interface RuleEngineOptions {
chunkSize?: number;
}
export declare class RuleEngine {
private rules;
private options;
private seenValues;
constructor(rules: Rule[], options?: RuleEngineOptions);
private initUniqueTracking;
validateFile(filePath: string, outputErrorFile: string): Promise<boolean>;
private validateCSV;
private validateExcel;
private validateChunk;
}