Handle parsing of empty arrays.

This commit is contained in:
Spencer Ofwiti 2021-04-07 10:25:41 +03:00
parent 08be01043a
commit 4d64a57591
2 changed files with 2 additions and 2 deletions

View File

@ -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 => {

View File

@ -1,4 +1,4 @@
import {Injectable, isDevMode} from '@angular/core';
import {Injectable} from '@angular/core';
import {
HttpRequest,
HttpHandler,