Skip to content

Commit 3755ea2

Browse files
committed
Auto-generated commit
1 parent 164cd09 commit 3755ea2

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

.github/.keepalive

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

lib/contains.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ var isCollection = require( '@stdlib/assert-is-collection' );
2424
var isInteger = require( '@stdlib/assert-is-integer' ).isPrimitive;
2525
var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
2626
var isnan = require( '@stdlib/assert-is-nan' ).isPrimitive;
27+
var format = require( '@stdlib/string-format' );
2728

2829

2930
// MAIN //
@@ -73,14 +74,14 @@ function contains( val, searchValue, position ) {
7374
var pos;
7475
var i;
7576
if ( !isCollection( val ) && !isString( val ) ) {
76-
throw new TypeError( 'invalid argument. First argument must be array-like. Value: `' + val + '`.' );
77+
throw new TypeError( format( 'invalid argument. First argument must be array-like. Value: `%s`.', val ) );
7778
}
7879
if ( arguments.length < 2 ) {
7980
throw new Error( 'insufficient input arguments. Must provide a search value.' );
8081
}
8182
if ( arguments.length > 2 ) {
8283
if ( !isInteger( position ) ) {
83-
throw new TypeError( 'invalid argument. Third argument must be an integer. Value: `' + position + '`.' );
84+
throw new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', position ) );
8485
}
8586
pos = position;
8687
if ( pos < 0 ) {
@@ -91,7 +92,7 @@ function contains( val, searchValue, position ) {
9192
}
9293
if ( isString( val ) ) {
9394
if ( !isString( searchValue ) ) {
94-
throw new TypeError( 'invalid argument. Second argument must be a string primitive. Value: `' + searchValue + '`.' );
95+
throw new TypeError( format( 'invalid argument. Second argument must be a string primitive. Value: `%s`.', searchValue ) );
9596
}
9697
return val.indexOf( searchValue, pos ) !== -1;
9798
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"@stdlib/assert-is-integer": "^0.0.x",
4242
"@stdlib/assert-is-nan": "^0.0.x",
4343
"@stdlib/assert-is-string": "^0.0.x",
44+
"@stdlib/string-format": "^0.0.x",
4445
"@stdlib/types": "^0.0.x"
4546
},
4647
"devDependencies": {

0 commit comments

Comments
 (0)