Update flatten method signature (#27752)

This commit is contained in:
Juanjo Diaz
2018-08-01 21:34:44 +03:00
committed by Sheetal Nandi
parent 48a6bcba6f
commit 459a7bd262
4 changed files with 7 additions and 5 deletions

View File

@@ -92,9 +92,10 @@ declare abstract class JSON2CSVBase<T> {
* Performs the flattening of a data row recursively
*
* @param {object} dataRow Original JSON object
* @param {string} separator Separator to be used as the flattened field name
* @returns {object} Flattened object
*/
protected flatten(dataRow: T): object;
protected flatten(dataRow: T, separator: string): object;
/**
* Performs the unwind recursively in specified sequence

View File

@@ -80,9 +80,10 @@ declare class JSON2CSVTransform<T> extends Transform { // implements JSON2CSVBas
* Performs the flattening of a data row recursively
*
* @param {object} dataRow Original JSON object
* @param {string} separator Separator to be used as the flattened field name
* @returns {object} Flattened object
*/
protected flatten(dataRow: T): object;
protected flatten(dataRow: T, separator: string): object;
/**
* Performs the unwind recursively in specified sequence

View File

@@ -1,4 +1,4 @@
// Type definitions for json2csv 4.1
// Type definitions for json2csv 4.2
// Project: https://github.com/zemirco/json2csv
// Definitions by: Juanjo Diaz <https://github.com/juanjoDiaz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

View File

@@ -76,7 +76,7 @@ class ParserExt extends Parser<ExampleObj> {
s = this.processValue(new Date(), true);
s = this.processValue({}, true);
s = this.processValue([], true);
const flattenedData: object = this.flatten({});
const flattenedData: object = this.flatten({}, '.');
const unwindedData: object[] = this.unwindData([], []);
}
}
@@ -110,7 +110,7 @@ class TransformExt extends Transform<ExampleObj> {
s = this.processValue(new Date(), true);
s = this.processValue({}, true);
s = this.processValue([], true);
const flattenedData: object = this.flatten({});
const flattenedData: object = this.flatten({}, '.');
const unwindedData: object[] = this.unwindData([], []);
}
}