File tree 1 file changed +4
-17
lines changed
1 file changed +4
-17
lines changed Original file line number Diff line number Diff line change @@ -103,28 +103,15 @@ exports.decodeTypedArraySpec = function(vIn) {
103
103
if ( ! T ) throw new Error ( 'Error in dtype: "' + dtype + '"' ) ;
104
104
var BYTES_PER_ELEMENT = T . BYTES_PER_ELEMENT ;
105
105
106
- var shape ;
107
106
var buffer = v . vals ;
108
107
if ( ! isArrayBuffer ( buffer ) ) {
109
- if ( v . shape === undefined ) {
110
- var len = buffer . length ;
111
- var n = 0.75 * len ;
112
- if ( buffer [ len - 2 ] === '=' ) {
113
- n -= 2 ;
114
- } else if ( buffer [ len - 1 ] === '=' ) {
115
- n -= 1 ;
116
- }
117
-
118
- shape = [ n / BYTES_PER_ELEMENT ] ;
119
- }
120
-
121
108
buffer = b64decode ( buffer ) ;
122
109
}
123
-
124
- if ( ! shape ) {
110
+ var shape = v . shape === undefined ?
111
+ // detect 1-d length
112
+ [ buffer . byteLength / BYTES_PER_ELEMENT ] :
125
113
// convert number to string and split to array
126
- shape = ( '' + v . shape ) . split ( ',' ) ;
127
- }
114
+ ( '' + v . shape ) . split ( ',' ) ;
128
115
129
116
var ndims = shape . length ;
130
117
You can’t perform that action at this time.
0 commit comments