You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewTypeError(format('invalid argument. Options argument must be an object. Value: `%s`.',options));
121
124
}
125
+
hasOpts=true;
122
126
cb=fcn;
123
127
ctx=thisArg;
124
128
}
125
129
if(!isFunction(cb)){
126
130
thrownewTypeError(format('invalid argument. Callback argument must be a function. Value: `%s`.',cb));
127
131
}
128
-
if(hasOwnProp(options,'depth')){
129
-
if(!isNonNegativeInteger(options.depth)){
130
-
thrownewTypeError(format('invalid option. `%s` option must be a nonnegative integer. Option: `%s`.',options.depth));
132
+
if(hasOpts){
133
+
if(hasOwnProp(options,'depth')){
134
+
if(!isNonNegativeInteger(options.depth)){
135
+
thrownewTypeError(format('invalid option. `%s` option must be a nonnegative integer. Option: `%s`.',options.depth));
136
+
}
137
+
opts.depth=options.depth;
131
138
}
132
-
opts.depth=options.depth;
133
-
}
134
-
if(hasOwnProp(options,'order')){
135
-
if(options.order==='any'){
136
-
// When 'any', we want to flatten according to the physical layout of the data in memory...
137
-
o=strides2order(getStrides(x));
138
-
if(o===1){
139
-
// Data is currently arranged in row-major order:
140
-
opts.order=ROW_MAJOR;
141
-
}elseif(o===2){
142
-
// Data is currently arranged in column-major order:
143
-
opts.order=COL_MAJOR;
144
-
}else{// o === 0 || o === 3 (i.e., neither row- nor column-major || both row- and column-major
145
-
// When the data is either both row- and column-major (e.g., a one-dimensional ndarray) or neither row- nor column-major (e.g., unordered strides), fallback to flattening according to the stated order of the input ndarray:
139
+
if(hasOwnProp(options,'order')){
140
+
if(options.order==='any'){
141
+
// When 'any', we want to flatten according to the physical layout of the data in memory...
142
+
o=strides2order(getStrides(x));
143
+
if(o===1){
144
+
// Data is currently arranged in row-major order:
145
+
opts.order=ROW_MAJOR;
146
+
}elseif(o===2){
147
+
// Data is currently arranged in column-major order:
148
+
opts.order=COL_MAJOR;
149
+
}else{// o === 0 || o === 3 (i.e., neither row- nor column-major || both row- and column-major
150
+
// When the data is either both row- and column-major (e.g., a one-dimensional ndarray) or neither row- nor column-major (e.g., unordered strides), fallback to flattening according to the stated order of the input ndarray:
151
+
opts.order=getOrder(x);
152
+
}
153
+
}elseif(options.order==='same'){
154
+
// When 'same', we want to flatten according to the stated order of the input ndarray:
146
155
opts.order=getOrder(x);
156
+
}elseif(isOrder(options.order)){
157
+
// When provided a specific order, flatten according to that order regardless of the order of the input ndarray:
158
+
opts.order=options.order;
159
+
}else{
160
+
thrownewTypeError(format('invalid option. `%s` option must be a recognized order. Option: `%s`.','order',options.order));
147
161
}
148
-
}elseif(options.order==='same'){
149
-
// When 'same', we want to flatten according to the stated order of the input ndarray:
150
-
opts.order=getOrder(x);
151
-
}elseif(isOrder(options.order)){
152
-
// When provided a specific order, flatten according to that order regardless of the order of the input ndarray:
153
-
opts.order=options.order;
154
-
}else{
155
-
thrownewTypeError(format('invalid option. `%s` option must be a recognized order. Option: `%s`.','order',options.order));
156
162
}
157
163
}
158
164
// Create an output ndarray having contiguous memory:
0 commit comments