use isArray instead of instanceof

This commit is contained in:
LenAnderson 2023-12-07 18:27:11 +00:00
parent 7bfed3fca1
commit 5a719d635a
1 changed files with 2 additions and 2 deletions

View File

@ -111,7 +111,7 @@ function addLocalVariable(name, value) {
const currentValue = getLocalVariable(name) || 0;
try {
const parsedValue = JSON.parse(currentValue);
if (typeof parsedValue == 'object' && parsedValue instanceof Array) {
if (Array.isArray(parsedValue)) {
parsedValue.push(value);
setGlobalVariable(name, JSON.stringify(parsedValue));
return parsedValue;
@ -139,7 +139,7 @@ function addGlobalVariable(name, value) {
const currentValue = getGlobalVariable(name) || 0;
try {
const parsedValue = JSON.parse(currentValue);
if (typeof parsedValue == 'object' && parsedValue instanceof Array) {
if (Array.isArray(parsedValue)) {
parsedValue.push(value);
setGlobalVariable(name, JSON.stringify(parsedValue));
return parsedValue;