Use Array.isArray

This commit is contained in:
Henry Mercer 2023-03-27 15:59:29 +01:00
parent 1e7a38893c
commit 57eca7cbb2
3 changed files with 9 additions and 9 deletions

View file

@ -823,7 +823,7 @@ export function fixInvalidNotifications(
);
return sarif;
}
if (!(sarif.runs instanceof Array)) {
if (!Array.isArray(sarif.runs)) {
return sarif;
}
@ -837,21 +837,21 @@ export function fixInvalidNotifications(
runs: sarif.runs.map((run) => {
if (
run.tool?.driver?.name !== "CodeQL" ||
!(run.invocations instanceof Array)
!Array.isArray(run.invocations)
) {
return run;
}
return {
...run,
invocations: run.invocations.map((invocation) => {
if (!(invocation.toolExecutionNotifications instanceof Array)) {
if (!Array.isArray(invocation.toolExecutionNotifications)) {
return invocation;
}
return {
...invocation,
toolExecutionNotifications:
invocation.toolExecutionNotifications.map((notification) => {
if (!(notification.locations instanceof Array)) {
if (!Array.isArray(notification.locations)) {
return notification;
}
const newLocations = removeDuplicateLocations(