Skip to content

Commit

Permalink
[wip] a few todos
Browse files Browse the repository at this point in the history
- do the Lib.extend* methods do the right for typed arrays
- what to do with 2d arrays? Should we start supporting ndarrays?
- should we invent a JSON-seriliazable version of typed arrays?
  • Loading branch information
etpinard committed Feb 20, 2018
1 parent bcf59d7 commit bc32981
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/coerce.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ exports.valObjectMeta = {
requiredOpts: [],
otherOpts: ['dflt'],
coerceFunction: function(v, propOut, dflt) {
// TODO maybe `v: {type: 'float32', vals: [/* ... */]}` also
if(isArrayOrTypedArray(v)) propOut.set(v);
else if(dflt !== undefined) propOut.set(dflt);
}
Expand Down
2 changes: 2 additions & 0 deletions src/lib/extend.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ function _extend(inputs, isDeep, keepAllKeys, noArrayCopies) {

var input, key, src, copy, copyIsArray, clone, allPrimitives;

// TODO does this do the right thing for typed arrays?

if(length === 2 && isArray(target) && isArray(inputs[1]) && target.length === 0) {

allPrimitives = primitivesLoopSplice(inputs[1], target);
Expand Down
1 change: 1 addition & 0 deletions src/traces/surface/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
var x = coerce('x');
coerce('y');

// TODO
traceOut._xlength = (Array.isArray(x) && Array.isArray(x[0])) ? z.length : z[0].length;
traceOut._ylength = z.length;

Expand Down

0 comments on commit bc32981

Please sign in to comment.