mirror of
https://github.com/dadosfera/maestro.git
synced 2026-09-01 12:18:15 +00:00
15 lines
352 B
TypeScript
15 lines
352 B
TypeScript
import { stringify } from 'csv'
|
|
import { Parser } from './parser.interface';
|
|
|
|
export class CsvParser<T> implements Parser<T>{
|
|
async parse(data: T[]) {
|
|
return new Promise<string>((resolve, reject) => {
|
|
stringify(data, { header: true }, function (err, output) {
|
|
if (err) reject(err);
|
|
|
|
resolve(output)
|
|
});
|
|
})
|
|
}
|
|
}
|