mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
add flattenSeparator option (#40965)
This commit is contained in:
Vendored
+1
@@ -27,6 +27,7 @@ export declare namespace json2csv {
|
||||
unwind?: string | Array<string>;
|
||||
unwindBlank?: boolean;
|
||||
flatten?: boolean;
|
||||
flattenSeparator?: string;
|
||||
defaultValue?: string;
|
||||
quote?: string;
|
||||
doubleQuote?: string;
|
||||
|
||||
Vendored
+1
@@ -2,6 +2,7 @@
|
||||
// Project: https://github.com/zemirco/json2csv
|
||||
// Definitions by: Juanjo Diaz <https://github.com/juanjoDiaz>
|
||||
// Daniel Gooß <https://github.com/dangoo>
|
||||
// Denis Yilmaz <https://github.com/denisyilmaz>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.2
|
||||
|
||||
|
||||
@@ -86,6 +86,15 @@ try {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
// Test for Synchronous Parser with flatten and custom flattenSeparator
|
||||
try {
|
||||
const parser = new Parser<any>({ ...opts, flatten: true, flattenSeparator: ' / ' });
|
||||
const csv = parser.parse({ car: '', price: 1, foo: { bar: '' } });
|
||||
console.log(csv);
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
}
|
||||
|
||||
// Test convenience method "parse"
|
||||
try {
|
||||
const csv = parse(data, opts);
|
||||
|
||||
Reference in New Issue
Block a user