1 | import JSON2CSVBase = require("./JSON2CSVBase");
|
2 |
|
3 | declare class JSON2CSVParser<T> extends JSON2CSVBase<T> {
|
4 | /**
|
5 | * Main function that converts json to csv.
|
6 | *
|
7 | * @param data Array of JSON objects to be converted to CSV
|
8 | * @returns The CSV formated data as a string
|
9 | */
|
10 | parse(data: Readonly<T> | readonly T[]): string;
|
11 |
|
12 | /**
|
13 | * Preprocess the data according to the give opts (unwind, flatten, etc.)
|
14 | * and calculate the fields and field names if they are not provided.
|
15 | *
|
16 | * @param data Array or object to be converted to CSV
|
17 | * @returns Preprocessed data ready to be processed
|
18 | */
|
19 | protected preprocessData(data: T | T[]): T[];
|
20 |
|
21 | /**
|
22 | * Create the content row by row below the header
|
23 | *
|
24 | * @param data Array of JSON objects to be converted to CSV
|
25 | * @returns CSV string (body)
|
26 | */
|
27 | protected processData(data: T[]): string;
|
28 | }
|
29 |
|
30 | export = JSON2CSVParser;
|