UNPKG

typedsv

Version:

Parse and map delimiter-separated values (csv, tsv, etc.) to TypeScript/ES6+ classes.

52 lines (51 loc) 1.36 kB
import { InputType } from '../common/InputType'; interface Range { start?: number; end?: number; } export interface ReaderOptions { strict?: boolean; headers?: boolean | string[]; quote?: string; escape?: string; delimiter?: string; newline?: string; comment?: string; range?: [number?, number?] | Range; mapHeaders?: (headers: string[]) => string[]; onHeaders?: (headers: string[]) => void; onRow?: (row: string[] | object, line: number) => void; } export interface ReaderResult { headers?: string[]; rows: string[][] | object[]; } export declare class Reader { private readonly strict; private readonly range; private readonly headers; private readonly quote; private readonly escape; private readonly delimiter; private readonly newline; private readonly comment; private readonly mapHeaders?; private readonly onHeaders?; private readonly onRow?; private escaped; private quoted; private commented; private lineNumber; private actualLine; private maxColumns; private result; private readonly cr; private readonly space; constructor(options?: ReaderOptions); read(input: InputType): Promise<ReaderResult>; private reset; private readReadable; private readBuffer; private rowCallback; } export {};