forked from boychina/json2csv
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.d.ts
More file actions
48 lines (41 loc) · 1.24 KB
/
Copy pathindex.d.ts
File metadata and controls
48 lines (41 loc) · 1.24 KB
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
47
48
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 | string[];
excelStrings?: boolean;
includeEmptyRows?: boolean;
preserveNewLinesInValues?: boolean;
withBOM?: 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;