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('invalid argument. Must provide either a valid data source, options argument, or both. Value: `'+options+'`.');
131
+
thrownewTypeError(format('invalid argument. Must provide either a valid data source, options argument, or both. Value: `%s`.',options));
131
132
}
132
133
if(hasOwnProp(options,'buffer')){
133
134
buffer=options.buffer;
134
135
if(!isArrayLikeObject(buffer)){// weak test
135
-
thrownewTypeError('invalid option. `buffer` option must be an array-like object, typed-array-like, a Buffer, or an ndarray. Option: `'+buffer+'`.');
136
+
thrownewTypeError(format('invalid option. `%s` option must be an array-like object, typed-array-like, a Buffer, or an ndarray. Option: `%s`.','buffer',buffer));
136
137
}
137
138
}
138
139
}
139
140
}else{
140
141
buffer=arguments[0];
141
142
if(!isArrayLikeObject(buffer)){// weak test
142
-
thrownewTypeError('invalid option. Data source must be an array-like object, typed-array-like, a Buffer, or an ndarray. Value: `'+buffer+'`.');
143
+
thrownewTypeError(format('invalid option. Data source must be an array-like object, typed-array-like, a Buffer, or an ndarray. Value: `%s`.',buffer));
143
144
}
144
145
options=arguments[1];
145
146
if(!isObject(options)){
146
-
thrownewTypeError('invalid argument. Options argument must be an object. Value: `'+options+'`.');
147
+
thrownewTypeError(format('invalid argument. Options argument must be an object. Value: `%s`.',options));
147
148
}
148
149
// Note: we ignore whether `options` has a `buffer` property
149
150
}
@@ -163,23 +164,23 @@ function array() {
163
164
if(hasOwnProp(options,'casting')){
164
165
opts.casting=options.casting;
165
166
if(!isCastingMode(opts.casting)){
166
-
thrownewTypeError('invalid option. `casting` option must be a recognized casting mode. Option: `'+opts.casting+'`.');
167
+
thrownewTypeError(format('invalid option. `%s` option must be a recognized casting mode. Option: `%s`.','casting',opts.casting));
167
168
}
168
169
}else{
169
170
opts.casting=defaults.casting;
170
171
}
171
172
if(hasOwnProp(options,'flatten')){
172
173
opts.flatten=options.flatten;
173
174
if(!isBoolean(opts.flatten)){
174
-
thrownewTypeError('invalid option. `flatten` option must be a boolean. Option: `'+opts.flatten+'`.');
175
+
thrownewTypeError(format('invalid option. `%s` option must be a boolean. Option: `%s`.','flatten',opts.flatten));
175
176
}
176
177
}else{
177
178
opts.flatten=defaults.flatten;
178
179
}
179
180
if(hasOwnProp(options,'ndmin')){
180
181
opts.ndmin=options.ndmin;
181
182
if(!isNonNegativeInteger(opts.ndmin)){
182
-
thrownewTypeError('invalid option. `ndmin` option must be a nonnegative integer. Option: `'+opts.ndmin+'`.');
183
+
thrownewTypeError(format('invalid option. `%s` option must be a nonnegative integer. Option: `%s`.','ndmin',opts.ndmin));
183
184
}
184
185
// TODO: validate that minimum number of dimensions does not exceed the maximum number of possible dimensions (in theory, infinite; in practice, determined by max array length; see https://github.com/stdlib-js/stdlib/blob/ac350059877c036640775d6b30d0e98e840d07cf/lib/node_modules/%40stdlib/ndarray/ctor/lib/main.js#L57)
185
186
}else{
@@ -190,10 +191,10 @@ function array() {
190
191
if(hasOwnProp(options,'dtype')){
191
192
dtype=options.dtype;
192
193
if(!isDataType(dtype)){
193
-
thrownewTypeError('invalid option. `dtype` option must be a recognized data type. Option: `'+dtype+'`.');
194
+
thrownewTypeError(format('invalid option. `%s` option must be a recognized data type. Option: `%s`.','dtype',dtype));
thrownewError('invalid option. Data type cast is not allowed. Casting mode: `'+opts.casting+'`. From: `'+btype+'`. To: `'+dtype+'`.');
197
+
thrownewError(format('invalid option. Data type cast is not allowed. Casting mode: `%s`. From: `%s`. To: `%s`.',opts.casting,btype,dtype));
197
198
}
198
199
}elseif(btype){
199
200
// TODO: reconcile difference in behavior when provided a generic array and no `dtype` option. Currently, we cast here, but do not allow casting a generic array (by default) when explicitly providing a `dtype` option.
@@ -231,7 +232,7 @@ function array() {
231
232
order=defaults.order;
232
233
}
233
234
}elseif(!isOrder(order)){
234
-
thrownewTypeError('invalid option. `order` option must be a recognized order. Option: `'+order+'`.');
235
+
thrownewTypeError(format('invalid option. `%s` option must be a recognized order. Option: `%s`.','order',order));
235
236
}
236
237
}else{
237
238
order=defaults.order;
@@ -254,7 +255,7 @@ function array() {
254
255
if(hasOwnProp(options,'copy')){
255
256
opts.copy=options.copy;
256
257
if(!isBoolean(opts.copy)){
257
-
thrownewTypeError('invalid option. `copy` option must be a boolean. Option: `'+opts.copy+'`.');
258
+
thrownewTypeError(format('invalid option. `%s` option must be a boolean. Option: `%s`.','copy',opts.copy));
258
259
}
259
260
}else{
260
261
opts.copy=defaults.copy;
@@ -263,7 +264,7 @@ function array() {
263
264
if(hasOwnProp(options,'shape')){
264
265
shape=options.shape;
265
266
if(!isArrayLikeObject(shape)){// weak test
266
-
thrownewTypeError('invalid option. `shape` option must be an array-like object containing nonnegative integers. Option: `'+shape+'`.');
267
+
thrownewTypeError(format('invalid option. `%s` option must be an array-like object containing nonnegative integers. Option: `%s`.','shape',shape));
0 commit comments