Skip to content

Commit 30c5fdc

Browse files
committed
Use isArrayOrTypedArray
1 parent fb34250 commit 30c5fdc

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/traces/quiver/defaults.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,20 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
2222
coerce('c');
2323

2424
// Simple validation - check if we have the required arrays
25-
if(!x || !Array.isArray(x) || x.length === 0 ||
26-
!y || !Array.isArray(y) || y.length === 0) {
25+
// Use Lib.isArrayOrTypedArray to support both regular arrays and typed arrays
26+
if(!x || !Lib.isArrayOrTypedArray(x) || x.length === 0 ||
27+
!y || !Lib.isArrayOrTypedArray(y) || y.length === 0) {
2728
traceOut.visible = false;
2829
return;
2930
}
3031

3132
// If u/v are missing, default to zeros so the trace participates in calc/category logic
3233
var len = Math.min(x.length, y.length);
33-
if(!Array.isArray(u) || u.length === 0) {
34+
if(!Lib.isArrayOrTypedArray(u) || u.length === 0) {
3435
traceOut.u = new Array(len);
3536
for(var i = 0; i < len; i++) traceOut.u[i] = 0;
3637
}
37-
if(!Array.isArray(v) || v.length === 0) {
38+
if(!Lib.isArrayOrTypedArray(v) || v.length === 0) {
3839
traceOut.v = new Array(len);
3940
for(var j = 0; j < len; j++) traceOut.v[j] = 0;
4041
}
@@ -89,5 +90,3 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
8990
// Set the data length
9091
traceOut._length = len;
9192
};
92-
93-

0 commit comments

Comments
 (0)