Skip to content

Commit c4299fa

Browse files
committed
Auto-generated commit
1 parent cd23adc commit c4299fa

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/validate.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var isObject = require( '@stdlib/assert-is-plain-object' );
2424
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
2525
var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
2626
var dtypes = require( '@stdlib/array-typed-dtypes' );
27+
var format = require( '@stdlib/string-format' );
2728
var contains = require( './contains.js' );
2829

2930

@@ -57,21 +58,21 @@ var DTYPES = dtypes();
5758
*/
5859
function validate( opts, options ) {
5960
if ( !isObject( options ) ) {
60-
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
61+
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
6162
}
6263
if ( hasOwnProp( options, 'dtype' ) ) {
6364
opts.dtype = options.dtype;
6465
if ( !isString( opts.dtype ) ) {
65-
return new TypeError( 'invalid option. `dtype` option must be a string. Option: `' + opts.dtype + '`.' );
66+
return new TypeError( format( 'invalid option. `%s` option must be a string primitive. Option: `%s`.', 'dtype', opts.dtype ) );
6667
}
6768
if ( !contains( DTYPES, opts.dtype ) ) {
68-
return new Error( 'invalid option. `dtype` option must be a recognized data type. Option: `' + opts.dtype + '`.' );
69+
return new Error( format( 'invalid option. `dtype` option must be a recognized data type. Option: `%s`.', opts.dtype ) );
6970
}
7071
}
7172
if ( hasOwnProp( options, 'name' ) ) {
7273
opts.name = options.name;
7374
if ( !isString( opts.name ) ) {
74-
return new TypeError( 'invalid option. `name` option must be a string. Option: `' + opts.name + '`.' );
75+
return new TypeError( format( 'invalid option. `%s` option must be a string primitive. Option: `%s`.', 'name', opts.name ) );
7576
}
7677
}
7778
return null;

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
"@stdlib/assert-is-string": "^0.0.x",
5353
"@stdlib/assert-is-string-array": "^0.0.x",
5454
"@stdlib/math-base-special-floor": "^0.0.x",
55+
"@stdlib/string-format": "^0.0.x",
5556
"@stdlib/symbol-iterator": "^0.0.x",
5657
"@stdlib/types": "^0.0.x",
5758
"@stdlib/utils-define-nonenumerable-property": "^0.0.x",

0 commit comments

Comments
 (0)