Skip to content

Commit c8614f7

Browse files
committed
Format error messages
1 parent 1c7517b commit c8614f7

File tree

42 files changed

+192
-151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+192
-151
lines changed

lib/node_modules/@stdlib/_tools/github/user-repos/lib/factory.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
var isFunction = require( '@stdlib/assert/is-function' );
2424
var merge = require( '@stdlib/utils/merge' );
2525
var request = require( '@stdlib/_tools/github/get' ).factory;
26+
var format = require( '@stdlib/string/format' );
2627
var validate = require( './validate.js' );
2728
var defaults = require( './defaults.json' );
2829
var query = require( './query.js' );
@@ -56,7 +57,7 @@ function factory( options, clbk ) {
5657
throw err;
5758
}
5859
if ( !isFunction( clbk ) ) {
59-
throw new TypeError( 'invalid argument. Callback argument must be a function. Value: `' + clbk + '`.' );
60+
throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );
6061
}
6162
if (
6263
opts.token === void 0 &&

lib/node_modules/@stdlib/_tools/licenses/insert-header-file-list/lib/main.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ var cwd = require( '@stdlib/process/cwd' );
3535
var nextTick = require( '@stdlib/utils/next-tick' );
3636
var extname = require( '@stdlib/utils/extname' );
3737
var insert = require( '@stdlib/_tools/licenses/insert-header' );
38+
var format = require( '@stdlib/string/format' );
3839
var normalizeHeader = require( './normalize_header.js' );
3940

4041

@@ -87,21 +88,21 @@ function insertHeader( files, header, clbk ) {
8788

8889
FLG = isEmptyArray( files );
8990
if ( !FLG && !isStringArray( files ) ) {
90-
throw new TypeError( 'invalid argument. First argument must be an array of strings. Value: `' + files + '`.' );
91+
throw new TypeError( format( 'invalid argument. First argument must be an array of strings. Value: `%s`.', files ) );
9192
}
9293
if ( isObject( header ) ) {
9394
keys = objectKeys( header );
9495
for ( i = 0; i < keys.length; i++ ) {
9596
v = header[ keys[i] ];
9697
if ( !isString( v ) ) {
97-
throw new TypeError( 'invalid argument. A `header` object must map each filename extension to a license header string. `' + keys[i] + ': ' + v + '`. Value: `' + JSON.stringify( header ) + '`.' );
98+
throw new TypeError( format( 'invalid argument. A `header` object must map each filename extension to a license header string. `%s: %s`. Value: `%s`.', keys[i], v, JSON.stringify( header ) ) );
9899
}
99100
}
100101
} else if ( !isString( header ) ) {
101-
throw new TypeError( 'invalid argument. Second argument must be either a primitive string or an object whose keys are filename extensions and whose values are header strings. Value: `' + header + '`.' );
102+
throw new TypeError( format( 'invalid argument. Second argument must be either a primitive string or an object whose keys are filename extensions and whose values are header strings. Value: `%s`.', header ) );
102103
}
103104
if ( !isFunction( clbk ) ) {
104-
throw new TypeError( 'invalid argument. Callback argument must be a function. Value: `' + clbk + '`.' );
105+
throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) );
105106
}
106107
dir = cwd();
107108
debug( 'Current working directory: %s', dir );

lib/node_modules/@stdlib/_tools/remark/plugins/remark-run-javascript-examples/lib/validate.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
2626
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
2727
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
2828
var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive;
29+
var format = require( '@stdlib/string/format' );
2930

3031

3132
// MAIN //
@@ -57,41 +58,41 @@ var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).is
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, 'cwd' ) ) {
6364
if ( !isString( options.cwd ) ) {
64-
return new TypeError( 'invalid option. `cwd` option must be a string primitive. Option: `' + options.cwd + '`.' );
65+
return new TypeError( format( 'invalid option. `%s` option must be a string primitive. Option: `%s`.', 'cwd', options.cwd ) );
6566
}
6667
opts.cwd = options.cwd;
6768
}
6869
if ( hasOwnProp( options, 'quiet' ) ) {
6970
if ( !isBoolean( options.quiet ) ) {
70-
return new TypeError( 'invalid option. `quiet` option must be a boolean primitive. Option: `' + options.quiet + '`.' );
71+
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'quiet', options.quiet ) );
7172
}
7273
opts.quiet = options.quiet;
7374
}
7475
if ( hasOwnProp( options, 'silent' ) ) {
7576
if ( !isBoolean( options.silent ) ) {
76-
return new TypeError( 'invalid option. `silent` option must be a boolean primitive. Option: `' + options.silent + '`.' );
77+
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'silent', options.silent ) );
7778
}
7879
opts.silent = options.silent;
7980
}
8081
if ( hasOwnProp( options, 'verbose' ) ) {
8182
if ( !isBoolean( options.verbose ) ) {
82-
return new TypeError( 'invalid option. `verbose` option must be a boolean primitive. Option: `' + options.verbose + '`.' );
83+
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'verbose', options.verbose ) );
8384
}
8485
opts.verbose = options.verbose;
8586
}
8687
if ( hasOwnProp( options, 'maxBuffer' ) ) {
8788
if ( !isPositiveInteger( options.maxBuffer ) ) {
88-
return new TypeError( 'invalid option. `maxBuffer` option must be a positive integer. Option: `' + options.maxBuffer + '`.' );
89+
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'maxBuffer', options.maxBuffer ) );
8990
}
9091
opts.maxBuffer = options.maxBuffer;
9192
}
9293
if ( hasOwnProp( options, 'timeout' ) ) {
9394
if ( !isNonNegativeInteger( options.timeout ) ) {
94-
return new TypeError( 'invalid option. `timeout` option must be a nonnegative integer. Option: `' + options.timeout + '`.' );
95+
return new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'timeout', options.timeout ) );
9596
}
9697
opts.timeout = options.timeout;
9798
}

lib/node_modules/@stdlib/_tools/remark/plugins/remark-stdlib-urls-www/lib/attacher.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var copy = require( '@stdlib/utils/copy' );
2525
var isObject = require( '@stdlib/assert/is-plain-object' );
2626
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2727
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
28+
var format = require( '@stdlib/string/format' );
2829
var transformerFactory = require( './transformer.js' );
2930
var defaults = require( './defaults.json' );
3031

@@ -51,11 +52,11 @@ function attacher( options ) {
5152
// NOTE: cannot use `arguments.length` check, as `options` may be explicitly passed as `undefined`
5253
if ( options !== void 0 ) {
5354
if ( !isObject( options ) ) {
54-
throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );
55+
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
5556
}
5657
if ( hasOwnProp( options, 'base' ) ) {
5758
if ( !isString( options.base ) ) {
58-
throw new TypeError( 'invalid option. `base` option must be a string primitive. Value: `' + options.base + '`.' );
59+
throw new TypeError( format( 'invalid option. `%s` option must be a string primitive. Value: `%s`.', 'base', options.base ) );
5960
}
6061
opts.base = options.base;
6162
}

lib/node_modules/@stdlib/_tools/remark/plugins/remark-svg-equations-to-file/lib/attacher.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var copy = require( '@stdlib/utils/copy' );
2525
var isObject = require( '@stdlib/assert/is-plain-object' );
2626
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
2727
var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
28+
var format = require( '@stdlib/string/format' );
2829
var transformerFactory = require( './transformer.js' );
2930
var defaults = require( './defaults.json' );
3031

@@ -52,17 +53,17 @@ function attacher( options ) {
5253
// NOTE: cannot use `arguments.length` check, as `options` may be explicitly passed as `undefined`
5354
if ( options !== void 0 ) {
5455
if ( !isObject( options ) ) {
55-
throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );
56+
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
5657
}
5758
if ( hasOwnProp( options, 'dir' ) ) {
5859
if ( !isString( options.dir ) ) {
59-
throw new TypeError( 'invalid option. `dir` option must be a string primitive. Value: `' + options.dir + '`.' );
60+
throw new TypeError( format( 'invalid option. `%s` option must be a string primitive. Value: `%s`.', 'dir', options.dir ) );
6061
}
6162
opts.dir = options.dir;
6263
}
6364
if ( hasOwnProp( options, 'prefix' ) ) {
6465
if ( !isString( options.prefix ) ) {
65-
throw new TypeError( 'invalid option. `prefix` option must be a string primitive. Value: `' + options.prefix + '`.' );
66+
throw new TypeError( format( 'invalid option. `%s` option must be a string primitive. Value: `%s`.', 'prefix', options.prefix ) );
6667
}
6768
opts.prefix = options.prefix;
6869
}

lib/node_modules/@stdlib/_tools/scaffold/test-validate-js/lib/create.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var isString = require( '@stdlib/assert/is-string' ).isPrimitive;
3333
var isBuffer = require( '@stdlib/assert/is-buffer' );
3434
var startsWith = require( '@stdlib/string/starts-with' );
3535
var replace = require( '@stdlib/string/replace' );
36+
var format = require( '@stdlib/string/format' );
3637
var DESCRIPTIONS = require( './descriptions.json' );
3738
var VALID_VALS = require( './valid_values.json' );
3839
var VALUES = require( './values.json' );
@@ -194,7 +195,7 @@ function create( src ) {
194195
src = src.toString();
195196
}
196197
else if ( !isString( src ) ) {
197-
throw new TypeError( 'invalid argument. Must provide either a string primitive or Buffer. Value: `' + src + '`.' );
198+
throw new TypeError( format( 'invalid argument. Must provide either a string primitive or Buffer. Value: `%s`.', src ) );
198199
}
199200
comments = [];
200201
parse( src, {

lib/node_modules/@stdlib/iter/intersection-by-hash/lib/main.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var isFunction = require( '@stdlib/assert/is-function' );
2525
var isIteratorLike = require( '@stdlib/assert/is-iterator-like' );
2626
var iteratorSymbol = require( '@stdlib/symbol/iterator' );
2727
var LinkedList = require( '@stdlib/utils/linked-list' );
28+
var format = require( '@stdlib/string/format' );
2829

2930

3031
// FUNCTIONS //
@@ -202,7 +203,7 @@ function iterIntersectionByHash() {
202203
}
203204
hashFcn = arguments[ i ];
204205
if ( !isFunction( hashFcn ) ) {
205-
throw new TypeError( 'invalid argument. Hash function argument must be a function. Value: `' + hashFcn + '`.' );
206+
throw new TypeError( format( 'invalid argument. Hash function argument must be a function. Value: `%s`.', hashFcn ) );
206207
}
207208
thisArg = arguments[ i+1 ];
208209

lib/node_modules/@stdlib/iter/replicate-by/lib/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var isFunction = require( '@stdlib/assert/is-function' );
2525
var isIteratorLike = require( '@stdlib/assert/is-iterator-like' );
2626
var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
2727
var iteratorSymbol = require( '@stdlib/symbol/iterator' );
28+
var format = require( '@stdlib/string/format' );
2829

2930

3031
// MAIN //
@@ -76,10 +77,10 @@ function iterReplicateBy( iterator, fcn, thisArg ) {
7677
var i;
7778
var j;
7879
if ( !isIteratorLike( iterator ) ) {
79-
throw new TypeError( 'invalid argument. First argument must be an iterator protocol-compliant object. Value: `' + iterator + '`.' );
80+
throw new TypeError( format( 'invalid argument. First argument must be an iterator protocol-compliant object. Value: `%s`.', iterator ) );
8081
}
8182
if ( !isFunction( fcn ) ) {
82-
throw new TypeError( 'invalid argument. Second argument must be a function. Value: `' + fcn + '`.' );
83+
throw new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );
8384
}
8485
t = -1; // total iteration index
8586
i = -1; // replicate counter

lib/node_modules/@stdlib/math/tools/unary/lib/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ var isCollection = require( '@stdlib/assert/is-collection' );
2828
var dtype = require( '@stdlib/ndarray/base/buffer-dtype' );
2929
var buffer = require( '@stdlib/ndarray/base/buffer' );
3030
var broadcast = require( '@stdlib/ndarray/base/broadcast-array' );
31+
var format = require( '@stdlib/string/format' );
3132
var ndarrayfcn = require( './ndarray.js' );
3233
var odtype = require( './resolve_output_dtype.js' );
3334
var defaults = require( './defaults.json' );
@@ -176,7 +177,7 @@ function dispatch( table, options ) {
176177
t.array( x.length, x, 1, y, 1 );
177178
return y;
178179
}
179-
throw new TypeError( 'invalid argument. Must provide an argument having a supported data type. Value: `' + x + '`.' );
180+
throw new TypeError( format( 'invalid argument. Must provide an argument having a supported data type. Value: `%s`.', x ) );
180181
}
181182

182183
/**
@@ -237,7 +238,7 @@ function dispatch( table, options ) {
237238
if ( isComplexLike( x ) ) {
238239
throw new TypeError( 'invalid argument. Providing a complex number is not supported. Consider providing a zero-dimensional ndarray containing the complex number value.' );
239240
}
240-
throw new TypeError( 'invalid argument. Must provide an argument having a supported data type. Value: `' + x + '`.' );
241+
throw new TypeError( format( 'invalid argument. Must provide an argument having a supported data type. Value: `%s`.', x ) );
241242
}
242243
}
243244

lib/node_modules/@stdlib/random/base/gumbel/lib/validate.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive;
2424
var isPositive = require( '@stdlib/assert/is-positive-number' ).isPrimitive;
25+
var format = require( '@stdlib/string/format' );
2526
var isnan = require( '@stdlib/assert/is-nan' );
2627

2728

@@ -43,10 +44,10 @@ var isnan = require( '@stdlib/assert/is-nan' );
4344
*/
4445
function validate( mu, beta ) {
4546
if ( !isNumber( mu ) || isnan( mu ) ) {
46-
return new TypeError( 'invalid argument. `mu` must be a number primitive and not `NaN`. Value: `' + mu + '`.' );
47+
return new TypeError( format( 'invalid argument. `%s` must be a number primitive and not `NaN`. Value: `%s`.', 'mu', mu ) );
4748
}
4849
if ( !isPositive( beta ) ) {
49-
return new TypeError( 'invalid argument. `beta` must be a positive number. Value: `' + beta + '`.' );
50+
return new TypeError( format( 'invalid argument. `%s` must be a positive number. Value: `%s`.', 'beta', beta) );
5051
}
5152
return null;
5253
}

lib/node_modules/@stdlib/random/base/minstd/lib/factory.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
3131
var isCollection = require( '@stdlib/assert/is-collection' );
3232
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
3333
var isInt32Array = require( '@stdlib/assert/is-int32array' );
34+
var format = require( '@stdlib/string/format' );
3435
var INT32_MAX = require( '@stdlib/constants/int32/max' );
3536
var Int32Array = require( '@stdlib/array/int32' );
3637
var gcopy = require( '@stdlib/blas/base/gcopy' );
@@ -144,19 +145,19 @@ function factory( options ) {
144145
opts = {};
145146
if ( arguments.length ) {
146147
if ( !isObject( options ) ) {
147-
throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );
148+
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
148149
}
149150
if ( hasOwnProp( options, 'copy' ) ) {
150151
opts.copy = options.copy;
151152
if ( !isBoolean( options.copy ) ) {
152-
throw new TypeError( 'invalid option. `copy` option must be a boolean. Option: `' + options.copy + '`.' );
153+
throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'copy', options.copy ) );
153154
}
154155
}
155156
if ( hasOwnProp( options, 'state' ) ) {
156157
state = options.state;
157158
opts.state = true;
158159
if ( !isInt32Array( state ) ) {
159-
throw new TypeError( 'invalid option. `state` option must be an Int32Array. Option: `' + state + '`.' );
160+
throw new TypeError( format( 'invalid option. `%s` option must be an Int32Array. Option: `%s`.', 'state', state ) );
160161
}
161162
err = verifyState( state, true );
162163
if ( err ) {
@@ -206,7 +207,7 @@ function factory( options ) {
206207
// Initialize the internal PRNG state:
207208
state[ 0 ] = seed[ 0 ];
208209
} else {
209-
throw new TypeError( 'invalid option. `seed` option must be either a positive integer less than the maximum signed 32-bit integer or an array-like object containing integer values less than the maximum signed 32-bit integer. Option: `' + seed + '`.' );
210+
throw new TypeError( format( 'invalid option. `%s` option must be either a positive integer less than the maximum signed 32-bit integer or an array-like object containing integer values less than the maximum signed 32-bit integer. Option: `%s`.', 'seed', seed ) );
210211
}
211212
} else {
212213
seed = randint32()|0; // asm type annotation
@@ -339,7 +340,7 @@ function factory( options ) {
339340
function setState( s ) {
340341
var err;
341342
if ( !isInt32Array( s ) ) {
342-
throw new TypeError( 'invalid argument. Must provide an Int32Array. Value: `' + s + '`.' );
343+
throw new TypeError( format( 'invalid argument. Must provide an Int32Array. Value: `%s`.', s ) );
343344
}
344345
err = verifyState( s, false );
345346
if ( err ) {

lib/node_modules/@stdlib/random/base/negative-binomial/lib/factory.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ var gcopy = require( '@stdlib/blas/base/gcopy' );
3737
var Uint32Array = require( '@stdlib/array/uint32' );
3838
var copy = require( '@stdlib/utils/copy' );
3939
var typedarray2json = require( '@stdlib/array/to-json' );
40+
var format = require( '@stdlib/string/format' );
4041
var validate = require( './validate.js' );
4142

4243

@@ -101,21 +102,21 @@ function factory() {
101102
} else if ( arguments.length === 1 ) {
102103
opts = arguments[ 0 ];
103104
if ( !isObject( opts ) ) {
104-
throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + opts + '`.' );
105+
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
105106
}
106107
if ( hasOwnProp( opts, 'copy' ) && !isBoolean( opts.copy ) ) {
107-
throw new TypeError( 'invalid option. `copy` option must be a boolean. Option: `' + opts.copy + '`.' );
108+
throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'copy', opts.copy ) );
108109
}
109110
if ( hasOwnProp( opts, 'prng' ) ) {
110111
if ( !isFunction( opts.prng ) ) {
111-
throw new TypeError( 'invalid option. `prng` option must be a pseudorandom number generator function. Option: `' + opts.prng + '`.' );
112+
throw new TypeError( format( 'invalid option. `prng` option must be a pseudorandom number generator function. Option: `%s`.', opts.prng ) );
112113
}
113114
rpois = poisson({
114115
'prng': opts.prng
115116
});
116117
} else {
117118
if ( hasOwnProp( opts, 'state' ) && !isUint32Array( opts.state ) ) {
118-
throw new TypeError( 'invalid option. `state` option must be a Uint32Array. Option: `' + opts.state + '`.' );
119+
throw new TypeError( format( 'invalid option. `%s` option must be a Uint32Array. Option: `%s`.', 'state', opts.state ) );
119120
}
120121
opts = copy( opts, 1 );
121122
if ( opts.copy === false ) {
@@ -136,21 +137,21 @@ function factory() {
136137
if ( arguments.length > 2 ) {
137138
opts = arguments[ 2 ];
138139
if ( !isObject( opts ) ) {
139-
throw new TypeError( 'invalid argument. Options argument must be an object. Value: `' + opts + '`.' );
140+
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
140141
}
141142
if ( hasOwnProp( opts, 'copy' ) && !isBoolean( opts.copy ) ) {
142-
throw new TypeError( 'invalid option. `copy` option must be a boolean. Option: `' + opts.copy + '`.' );
143+
throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'copy', opts.copy ) );
143144
}
144145
if ( hasOwnProp( opts, 'prng' ) ) {
145146
if ( !isFunction( opts.prng ) ) {
146-
throw new TypeError( 'invalid option. `prng` option must be a pseudorandom number generator function. Option: `' + opts.prng + '`.' );
147+
throw new TypeError( format( 'invalid option. `prng` option must be a pseudorandom number generator function. Option: `%s`.', opts.prng ) );
147148
}
148149
rpois = poisson({
149150
'prng': opts.prng
150151
});
151152
} else {
152153
if ( hasOwnProp( opts, 'state' ) && !isUint32Array( opts.state ) ) {
153-
throw new TypeError( 'invalid option. `state` option must be a Uint32Array. Option: `' + opts.state + '`.' );
154+
throw new TypeError( format( 'invalid option. `%s` option must be a Uint32Array. Option: `%s`.', 'state', opts.state ) );
154155
}
155156
opts = copy( opts, 1 );
156157
if ( opts.copy === false ) {
@@ -285,7 +286,7 @@ function factory() {
285286
*/
286287
function setState( s ) {
287288
if ( !isUint32Array( s ) ) {
288-
throw new TypeError( 'invalid argument. Must provide a Uint32Array. Value: `' + s + '`.' );
289+
throw new TypeError( format( 'invalid argument. Must provide a Uint32Array. Value: `%s`.', s ) );
289290
}
290291
if ( FLG ) {
291292
s = gcopy( s.length, s, 1, new Uint32Array( s.length ), 1 );

0 commit comments

Comments
 (0)