Blacked and isorted the python files
Prettied and eslinted the typescript/html files
This commit is contained in:
@ -1,17 +1,16 @@
|
||||
import {Injectable} from '@angular/core';
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
providedIn: 'root',
|
||||
})
|
||||
export class ToCsvService {
|
||||
|
||||
constructor() {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
toCsv(headers: any, data: any[]): string {
|
||||
const header = Object.keys(headers);
|
||||
const replacer = (key, value) => value === null ? '' : value;
|
||||
const csv = data.map(row => header.map(fieldName => JSON.stringify(row[headers[fieldName]], replacer)).join(','));
|
||||
const replacer = (key, value) => (value === null ? '' : value);
|
||||
const csv = data.map((row) =>
|
||||
header.map((fieldName) => JSON.stringify(row[headers[fieldName]], replacer)).join(','),
|
||||
);
|
||||
csv.unshift(header.join(','));
|
||||
return csv.join('\r\n');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user