import { json2csv } from 'json-2-csv';

/** Serializes rows to CSV, emitting only the given column fields. */
export function toCsv(rows: object[], fields: string[]): string {
  return json2csv(rows, { keys: fields, emptyFieldValue: '' });
}
