Skip to content

Commit 769ced5

Browse files
authored
fix: Use proper method for checking is object an array (#8644)
1 parent 34827b4 commit 769ced5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/text/cue.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ shaka.text.Cue = class {
350350
// Make copies of array fields, but only one level deep. That way, if we
351351
// change, for instance, textDecoration on the clone, we don't affect the
352352
// original.
353-
if (clone[k] && clone[k].constructor == Array) {
353+
if (Array.isArray(clone[k])) {
354354
clone[k] = /** @type {!Array} */(clone[k]).slice();
355355
}
356356
}

lib/util/object_utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ shaka.util.ObjectUtils = class {
5454
return null;
5555
}
5656

57-
const isArray = val.constructor == Array;
57+
const isArray = Array.isArray(val);
5858
if (val.constructor != Object && !isArray) {
5959
return null;
6060
}

0 commit comments

Comments
 (0)