stdlib-js / random-base-box-muller

Compare 6ab7d1c ... +2 ... 5759866

Coverage Reach
factory.js randn.js min.js max.js index.js main.js

Flags

Flags have been temporarily removed from this view while the flagging feature is refactored for better performance and user experience.

You can still use flags when viewing individual files. Flag-level thresholds will also remain on pull and merge requests in your repository provider.

More information can be found in our documentation.

Showing 1 of 7 files from the diff.

@@ -32,6 +32,7 @@
Loading
32 32
var constantFunction = require( '@stdlib/utils-constant-function' );
33 33
var noop = require( '@stdlib/utils-noop' );
34 34
var typedarray2json = require( '@stdlib/array-to-json' );
35 +
var format = require( '@stdlib/string-format' );
35 36
var randn0 = require( './randn.js' );
36 37
var getMin = require( './min.js' );
37 38
var getMax = require( './max.js' );
@@ -78,32 +79,32 @@
Loading
78 79
	};
79 80
	if ( arguments.length ) {
80 81
		if ( !isObject( options ) ) {
81 -
			throw new TypeError( 'invalid argument. Must provide an object. Value: `' + options + '`.' );
82 +
			throw new TypeError( format( 'invalid argument. Must provide an object. Value: `%s`.', options ) );
82 83
		}
83 84
		if ( hasOwnProp( options, 'copy' ) ) {
84 85
			opts.copy = options.copy;
85 86
			if ( !isBoolean( options.copy ) ) {
86 -
				throw new TypeError( 'invalid option. `copy` option must be a boolean. Option: `' + options.copy + '`.' );
87 +
				throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'copy', options.copy ) );
87 88
			}
88 89
		}
89 90
		if ( hasOwnProp( options, 'prng' ) ) {
90 91
			if ( !isFunction( options.prng ) ) {
91 -
				throw new TypeError( 'invalid option. `prng` option must be a pseudorandom number generator function. Option: `' + options.prng + '`.' );
92 +
				throw new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', options.prng ) );
92 93
			}
93 94
			randu = options.prng;
94 95
		}
95 96
		// If provided a PRNG, ignore the `state` option, as we don't support getting or setting PRNG state.
96 97
		else if ( hasOwnProp( options, 'state' ) ) {
97 98
			opts.state = options.state;
98 99
			if ( !isUint32Array( options.state ) ) {
99 -
				throw new TypeError( 'invalid option. `state` option must be a Uint32Array. Option: `' + options.state + '`.' );
100 +
				throw new TypeError( format( 'invalid option. `%s` option must be a Uint32Array. Option: `%s`.', 'state', options.state ) );
100 101
			}
101 102
		}
102 103
		// If provided a PRNG, ignore the `seed` option, as a `seed`, by itself, is insufficient to guarantee reproducibility. If provided a state, ignore the `seed` option, as a PRNG state should contain seed information.
103 104
		else if ( hasOwnProp( options, 'seed' ) ) {
104 105
			opts.seed = options.seed;
105 106
			if ( options.seed === void 0 ) {
106 -
				throw new TypeError( 'invalid option. `seed` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `' + options.seed + '`.' );
107 +
				throw new TypeError( format( 'invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.', 'seed', options.seed ) );
107 108
			}
108 109
		}
109 110
	}

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
lib 100.00%
Project Totals (6 files) 100.00%
Loading