Handle parsing of empty arrays.
This commit is contained in:
parent
08be01043a
commit
4d64a57591
@ -1,5 +1,5 @@
|
||||
function exportCsv(arrayData: any[], filename: string, delimiter = ','): void {
|
||||
if (arrayData === undefined) { return; }
|
||||
if (arrayData === undefined || arrayData.length === 0) { return; }
|
||||
const header = Object.keys(arrayData[0]).join(delimiter) + '\n';
|
||||
let csv = header;
|
||||
arrayData.forEach(obj => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import {Injectable, isDevMode} from '@angular/core';
|
||||
import {Injectable} from '@angular/core';
|
||||
import {
|
||||
HttpRequest,
|
||||
HttpHandler,
|
||||
|
Loading…
Reference in New Issue
Block a user