Archived
2
This repository has been archived on 2023-03-02. You can view files and clone it, but cannot push or open issues or pull requests.

10 lines
273 B
TypeScript
Raw Normal View History

2020-06-29 12:27:39 +02:00
import {parseAsync} from 'json2csv';
2020-08-10 12:35:08 +02:00
import flatten from './flatten';
2020-06-29 12:27:39 +02:00
2020-06-30 14:16:37 +02:00
export default function csv(input: any[], f: (err, data) => void) {
2020-07-02 12:18:01 +02:00
parseAsync(input.map(e => flatten(e)), {includeEmptyRows: true})
2020-06-29 12:27:39 +02:00
.then(csv => f(null, csv))
.catch(err => f(err, null));
2020-06-30 14:16:37 +02:00
}