Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Jul 26, 2023
1 parent d18e5a7 commit 4b7f882
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
9 changes: 9 additions & 0 deletions streams/binomial/lib/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

// MODULES //

var isPlainObject = require( '@stdlib/assert/is-plain-object' );
var assign = require( '@stdlib/object/assign' );
var format = require( '@stdlib/string/format' );
var RandomStream = require( './main.js' );


Expand All @@ -42,6 +44,7 @@ var RandomStream = require( './main.js' );
* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state
* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state
* @param {PositiveInteger} [options.siter] - number of iterations after which to emit the PRNG state
* @throws {TypeError} options argument must be an object
* @returns {Function} stream factory
*
* @example
Expand All @@ -68,8 +71,14 @@ function factory( n, p, options ) {

nargs = arguments.length;
if ( nargs === 1 ) {
if ( !isPlainObject( n ) ) {
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', n ) );
}
opts = assign( {}, n );
} else if ( nargs > 2 ) {
if ( !isPlainObject( options ) ) {
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
opts = assign( {}, options );
} else {
opts = {};
Expand Down
9 changes: 9 additions & 0 deletions streams/cauchy/lib/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

// MODULES //

var isPlainObject = require( '@stdlib/assert/is-plain-object' );
var assign = require( '@stdlib/object/assign' );
var format = require( '@stdlib/string/format' );
var RandomStream = require( './main.js' );


Expand All @@ -42,6 +44,7 @@ var RandomStream = require( './main.js' );
* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state
* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state
* @param {PositiveInteger} [options.siter] - number of iterations after which to emit the PRNG state
* @throws {TypeError} options argument must be an object
* @returns {Function} stream factory
*
* @example
Expand All @@ -68,8 +71,14 @@ function factory( x0, gamma, options ) {

nargs = arguments.length;
if ( nargs === 1 ) {
if ( !isPlainObject( x0 ) ) {
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', x0 ) );
}
opts = assign( {}, x0 );
} else if ( nargs > 2 ) {
if ( !isPlainObject( options ) ) {
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
opts = assign( {}, options );
} else {
opts = {};
Expand Down
9 changes: 9 additions & 0 deletions streams/chi/lib/factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@

// MODULES //

var isPlainObject = require( '@stdlib/assert/is-plain-object' );
var isPositive = require( '@stdlib/assert/is-positive-number' ).isPrimitive;
var assign = require( '@stdlib/object/assign' );
var format = require( '@stdlib/string/format' );
var RandomStream = require( './main.js' );


Expand All @@ -42,6 +44,7 @@ var RandomStream = require( './main.js' );
* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state
* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state
* @param {PositiveInteger} [options.siter] - number of iterations after which to emit the PRNG state
* @throws {TypeError} options argument must be an object
* @returns {Function} stream factory
*
* @example
Expand All @@ -68,13 +71,19 @@ function factory( k, options ) {

nargs = arguments.length;
if ( nargs > 1 ) {
if ( !isPlainObject( options ) ) {
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
fcn = createStream2;
opts = assign( {}, options );
} else if ( nargs === 1 ) {
if ( isPositive( k ) ) {
fcn = createStream2;
opts = {};
} else {
if ( !isPlainObject( k ) ) {
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', k ) );
}
opts = assign( {}, k );
fcn = createStream1;
}
Expand Down

0 comments on commit 4b7f882

Please sign in to comment.