stdlib-js / utils-find

@@ -26,6 +26,7 @@
Loading
26 26
var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
27 27
var isCollection = require( '@stdlib/assert-is-collection' );
28 28
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
29 +
var format = require( '@stdlib/string-format' );
29 30
30 31
31 32
// MAIN //
@@ -119,7 +120,7 @@
Loading
119 120
	returns = [ 'values', 'indices', '*' ];
120 121
121 122
	if ( !isCollection( arr ) && !isString( arr ) ) {
122 -
		throw new TypeError( 'invalid argument. Must provide an array-like object. Value: `' + arr + '`' );
123 +
		throw new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', arr ) );
123 124
	}
124 125
	len = arr.length;
125 126
	if ( arguments.length < 3 ) {
@@ -130,15 +131,15 @@
Loading
130 131
		cb = clbk;
131 132
	}
132 133
	if ( !isFunction( cb ) ) {
133 -
		throw new TypeError( 'invalid argument. Callback argument must be a function. Value: `' + cb + '`' );
134 +
		throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', cb ) );
134 135
	}
135 136
	if ( !isObject( opts ) ) {
136 -
		throw new TypeError( 'invalid argument. Options must be an object. Value: `' + opts + '`' );
137 +
		throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );
137 138
	}
138 139
	if ( hasOwnProp( opts, 'k' ) ) {
139 140
		k = opts.k;
140 141
		if ( !isInteger( k ) ) {
141 -
			throw new TypeError( 'invalid argument. `k` must be an integer. Value: `' + k + '`' );
142 +
			throw new TypeError( format( 'invalid argument. `k` must be an integer. Value: `%s`.', k ) );
142 143
		}
143 144
	} else {
144 145
		k = len;
@@ -146,7 +147,7 @@
Loading
146 147
	if ( hasOwnProp( opts, 'returns' ) ) {
147 148
		ret = opts.returns;
148 149
		if ( !isString( ret ) || returns.indexOf( ret ) === -1 ) {
149 -
			throw new TypeError( 'invalid argument. `returns` option must be a string and have one of the following values: `values`, `indices`, `all`. Value: `' + ret + '`' );
150 +
			throw new TypeError( format( 'invalid argument. `returns` option must be a string and have one of the following values: `values`, `indices`, `all`. Value: `%s`.', ret ) );
150 151
		}
151 152
		if ( ret === 'values' ) {
152 153
			mode = 1;
Files Coverage
lib 100.00%
Project Totals (2 files) 100.00%
2080792999
unittests
2074567553
unittests
2175376380
unittests
2139256105
unittests
2248817352
unittests
2211157466
unittests

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading