stdlib-js / stats-ranks
Showing 1 of 1 files from the diff.

@@ -25,6 +25,7 @@
Loading
25 25
var isObject = require( '@stdlib/assert-is-object' );
26 26
var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
27 27
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
28 +
var format = require( '@stdlib/string-format' );
28 29
29 30
30 31
// VARIABLES //
@@ -48,24 +49,24 @@
Loading
48 49
*/
49 50
function validate( opts, options ) {
50 51
	if ( !isObject( options ) ) {
51 -
		return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' );
52 +
		return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
52 53
	}
53 54
	if ( hasOwnProp( options, 'encoding' ) ) {
54 55
		opts.encoding = options.encoding;
55 56
		if ( !isArray( opts.encoding ) ) {
56 -
			return new TypeError( 'invalid option. `encoding` option must be an array. Option: `' + opts.encoding + '`.' );
57 +
			return new TypeError( format( 'invalid option. `%s` option must be an array. Option: `%s`.', 'encoding', opts.encoding ) );
57 58
		}
58 59
	}
59 60
	if ( hasOwnProp( options, 'method' ) ) {
60 61
		opts.method = options.method;
61 62
		if ( !isString( opts.method ) || !contains( METHODS, opts.method ) ) {
62 -
			return new TypeError( 'invalid option. `method` must be one of the following values: `average`, `min`, `max`, `dense`, or `ordinal`. Option: `' + opts.method + '`.' );
63 +
			return new TypeError( format( 'invalid option. `%s` must be one of the following: %s. Option: `%s`.', 'method', METHODS.join( ',' ), opts.method ) );
63 64
		}
64 65
	}
65 66
	if ( hasOwnProp( options, 'missing' ) ) {
66 67
		opts.missing = options.missing;
67 68
		if ( !isString( opts.missing ) || !contains( MISSING, opts.missing ) ) {
68 -
			return new TypeError( 'invalid option. `missing` must be one of the following values: `last`, `first`, or `remove`. Option: `' + opts.missing + '`.' );
69 +
			return new TypeError( format( 'invalid option. `%s` must be one of the following: %s. Option: `%s`.', 'missing', MISSING.join( ',' ), opts.missing ) );
69 70
		}
70 71
	}
71 72
	return null;
Files Coverage
lib 99.36%
Project Totals (6 files) 99.36%
2043508104
unittests
2018875126
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