10 lines
273 B
TypeScript
10 lines
273 B
TypeScript
import {parseAsync} from 'json2csv';
|
|
import flatten from './flatten';
|
|
|
|
export default function csv(input: any[], f: (err, data) => void) {
|
|
parseAsync(input.map(e => flatten(e)), {includeEmptyRows: true})
|
|
.then(csv => f(null, csv))
|
|
.catch(err => f(err, null));
|
|
}
|
|
|