Skip to content

Commit

Permalink
Try to see if we're comparing the empty array returned by default.
Browse files Browse the repository at this point in the history
  • Loading branch information
paambaati committed Apr 17, 2020
1 parent f3bdeee commit 473bbba
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const getOptionalArray = (name: string, def: string[] = []) => {
const input = getInput(name, { required: false });
return !input.length ? def : input.split(' ');
};
const flattenArray = (arr: any[]): any[] => [].concat(...arr);
const areObjectsEqual = (obj1: object | [], obj2: object | []): boolean =>
JSON.stringify(obj1) === JSON.stringify(obj2);

export function downloadToFile(
url: string,
Expand Down Expand Up @@ -104,10 +105,7 @@ export function run(
return reject(err);
}

if (
Array.isArray(coverageLocations) &&
flattenArray(coverageLocations).length > 0
) {
if (!areObjectsEqual(coverageLocations, [])) {
debug(
`Parsing ${
coverageLocations.length
Expand Down

0 comments on commit 473bbba

Please sign in to comment.