smart-csv-delimiter
Version:
Intelligent CSV delimiter auto-detection for Node.js - lightweight, fast, and reliable
41 lines • 971 B
TypeScript
export type CsvDelimiter = ',' | ';' | '|' | '\t';
export interface DetectionOptions {
/**
* Number of lines to analyze for delimiter detection
* @default 10
*/
sampleSize?: number;
/**
* Custom delimiters to detect (in addition to or instead of defaults)
*/
customDelimiters?: string[];
/**
* If true, only use customDelimiters (ignore defaults)
* @default false
*/
customOnly?: boolean;
/**
* Encoding of the CSV file
* @default 'utf-8'
*/
encoding?: BufferEncoding;
}
export interface DetectionResult {
/**
* The detected delimiter
*/
delimiter: string | null;
/**
* Confidence score (0-1) of the detection
*/
confidence: number;
/**
* Number of occurrences found
*/
occurrences: number;
/**
* All delimiters tested with their scores
*/
allScores: Record<string, number>;
}
//# sourceMappingURL=types.d.ts.map