forked from zemirco/json2csv
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
46 lines (39 loc) · 1.17 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
declare namespace json2csv {
interface FieldValueCallback<T> {
(row: T, field: string, data: string): string;
}
interface FieldBase {
label?: string;
default?: string;
}
interface Field extends FieldBase {
value: string;
}
interface CallbackField<T> extends FieldBase {
value: FieldValueCallback<T>;
}
interface Options<T> {
data: T[];
fields?: (string | Field | CallbackField<T>)[];
fieldNames?: string[];
del?: string;
defaultValue?: string;
quotes?: string;
doubleQuotes?: string;
hasCSVColumnTitle?: boolean;
eol?: string;
newLine?: string;
flatten?: boolean;
unwindPath?: string;
excelStrings?: boolean;
includeEmptyRows?: boolean;
}
interface Callback {
(error: Error, csv: string): void;
}
}
declare function json2csv<T>(options: json2csv.Options<T>, callback: json2csv.Callback): void;
declare function json2csv<T>(options: json2csv.Options<T>): string;
declare function json2csv(options: json2csv.Options<{ [key: string]: string; }>, callback: json2csv.Callback): void;
declare function json2csv(options: json2csv.Options<{ [key: string]: string; }>): string;
export = json2csv;