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 Mar 15, 2022
1 parent 60f4280 commit c64ee37
Show file tree
Hide file tree
Showing 27 changed files with 99 additions and 74 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -427,20 +427,20 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors].
-->

[umd]: https://github.com/umdjs/umd
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

[deno-url]: https://github.com/stdlib-js/utils/tree/deno
[umd-url]: https://github.com/stdlib-js/utils/tree/umd
[esm-url]: https://github.com/stdlib-js/utils/tree/esm

[chat-image]: https://img.shields.io/gitter/room/stdlib-js/stdlib.svg
[chat-url]: https://gitter.im/stdlib-js/stdlib/

[stdlib]: https://github.com/stdlib-js/stdlib

[stdlib-authors]: https://github.com/stdlib-js/stdlib/graphs/contributors

[umd]: https://github.com/umdjs/umd
[es-module]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules

[deno-url]: https://github.com/stdlib-js/utils/tree/deno
[umd-url]: https://github.com/stdlib-js/utils/tree/umd
[esm-url]: https://github.com/stdlib-js/utils/tree/esm

[stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils/main/LICENSE

<!-- <toc-links> -->
Expand Down
7 changes: 4 additions & 3 deletions async/any-by-right/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var format = require( '@stdlib/string/format' );


// MAIN //
Expand Down Expand Up @@ -53,21 +54,21 @@ var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimit
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'series' ) ) {
opts.series = options.series;
if ( !isBoolean( opts.series ) ) {
return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'series', opts.series ) );
}
}
if ( hasOwnProp( options, 'limit' ) ) {
opts.limit = options.limit;
if ( !isPositiveInteger( opts.limit ) ) {
return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
}
}
return null;
Expand Down
7 changes: 4 additions & 3 deletions async/any-by/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var format = require( '@stdlib/string/format' );


// MAIN //
Expand Down Expand Up @@ -53,21 +54,21 @@ var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimit
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'series' ) ) {
opts.series = options.series;
if ( !isBoolean( opts.series ) ) {
return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'series', opts.series ) );
}
}
if ( hasOwnProp( options, 'limit' ) ) {
opts.limit = options.limit;
if ( !isPositiveInteger( opts.limit ) ) {
return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
}
}
return null;
Expand Down
9 changes: 5 additions & 4 deletions async/bifurcate-by/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var indexOf = require( './../../../index-of' );
var format = require( '@stdlib/string/format' );


// VARIABLES //
Expand Down Expand Up @@ -61,27 +62,27 @@ var returns = [ 'values', 'indices', '*' ];
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'series' ) ) {
opts.series = options.series;
if ( !isBoolean( opts.series ) ) {
return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'series', opts.series ) );
}
}
if ( hasOwnProp( options, 'limit' ) ) {
opts.limit = options.limit;
if ( !isPositiveInteger( opts.limit ) ) {
return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
}
}
if ( hasOwnProp( options, 'returns' ) ) {
opts.returns = options.returns;
if ( indexOf( returns, opts.returns ) === -1 ) {
return new TypeError( 'invalid option. `returns` option must be one of the following: "' + returns.join( '", "' ) + '". Option: `' + opts.returns + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'returns', returns.join( '", "' ), opts.returns ) );
}
}
return null;
Expand Down
7 changes: 4 additions & 3 deletions async/count-by/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var format = require( '@stdlib/string/format' );


// MAIN //
Expand Down Expand Up @@ -53,21 +54,21 @@ var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimit
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'series' ) ) {
opts.series = options.series;
if ( !isBoolean( opts.series ) ) {
return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'series', opts.series ) );
}
}
if ( hasOwnProp( options, 'limit' ) ) {
opts.limit = options.limit;
if ( !isPositiveInteger( opts.limit ) ) {
return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
}
}
return null;
Expand Down
7 changes: 4 additions & 3 deletions async/every-by-right/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var format = require( '@stdlib/string/format' );


// MAIN //
Expand Down Expand Up @@ -53,21 +54,21 @@ var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimit
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'series' ) ) {
opts.series = options.series;
if ( !isBoolean( opts.series ) ) {
return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'series', opts.series ) );
}
}
if ( hasOwnProp( options, 'limit' ) ) {
opts.limit = options.limit;
if ( !isPositiveInteger( opts.limit ) ) {
return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
}
}
return null;
Expand Down
7 changes: 4 additions & 3 deletions async/every-by/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var format = require( '@stdlib/string/format' );


// MAIN //
Expand Down Expand Up @@ -53,21 +54,21 @@ var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimit
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'series' ) ) {
opts.series = options.series;
if ( !isBoolean( opts.series ) ) {
return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'series', opts.series ) );
}
}
if ( hasOwnProp( options, 'limit' ) ) {
opts.limit = options.limit;
if ( !isPositiveInteger( opts.limit ) ) {
return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
}
}
return null;
Expand Down
7 changes: 4 additions & 3 deletions async/for-each-right/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var format = require( '@stdlib/string/format' );


// MAIN //
Expand Down Expand Up @@ -53,21 +54,21 @@ var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimit
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'series' ) ) {
opts.series = options.series;
if ( !isBoolean( opts.series ) ) {
return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'series', opts.series ) );
}
}
if ( hasOwnProp( options, 'limit' ) ) {
opts.limit = options.limit;
if ( !isPositiveInteger( opts.limit ) ) {
return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
}
}
return null;
Expand Down
7 changes: 4 additions & 3 deletions async/for-each/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var format = require( '@stdlib/string/format' );


// MAIN //
Expand Down Expand Up @@ -53,21 +54,21 @@ var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimit
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'series' ) ) {
opts.series = options.series;
if ( !isBoolean( opts.series ) ) {
return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'series', opts.series ) );
}
}
if ( hasOwnProp( options, 'limit' ) ) {
opts.limit = options.limit;
if ( !isPositiveInteger( opts.limit ) ) {
return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
}
}
return null;
Expand Down
9 changes: 5 additions & 4 deletions async/group-by/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var indexOf = require( './../../../index-of' );
var format = require( '@stdlib/string/format' );


// VARIABLES //
Expand Down Expand Up @@ -61,27 +62,27 @@ var returns = [ 'values', 'indices', '*' ];
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'series' ) ) {
opts.series = options.series;
if ( !isBoolean( opts.series ) ) {
return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'series', opts.series ) );
}
}
if ( hasOwnProp( options, 'limit' ) ) {
opts.limit = options.limit;
if ( !isPositiveInteger( opts.limit ) ) {
return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
}
}
if ( hasOwnProp( options, 'returns' ) ) {
opts.returns = options.returns;
if ( indexOf( returns, opts.returns ) === -1 ) {
return new TypeError( 'invalid option. `returns` option must be one of the following: "' + returns.join( '", "' ) + '". Option: `' + opts.returns + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'returns', returns.join( '", "' ), opts.returns ) );
}
}
return null;
Expand Down
7 changes: 4 additions & 3 deletions async/none-by/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
var format = require( '@stdlib/string/format' );


// MAIN //
Expand Down Expand Up @@ -53,21 +54,21 @@ var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimit
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'series' ) ) {
opts.series = options.series;
if ( !isBoolean( opts.series ) ) {
return new TypeError( 'invalid option. `series` option must be a boolean primitive. Option: `' + opts.series + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'series', opts.series ) );
}
}
if ( hasOwnProp( options, 'limit' ) ) {
opts.limit = options.limit;
if ( !isPositiveInteger( opts.limit ) ) {
return new TypeError( 'invalid option. `limit` option must be a positive integer. Option: `' + opts.limit + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be a positive integer. Option: `%s`.', 'limit', opts.limit ) );
}
}
return null;
Expand Down
5 changes: 3 additions & 2 deletions bifurcate-by/lib/validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
var isObject = require( '@stdlib/assert/is-plain-object' );
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
var indexOf = require( './../../index-of' );
var format = require( '@stdlib/string/format' );


// VARIABLES //
Expand Down Expand Up @@ -55,15 +56,15 @@ var returns = [ 'values', 'indices', '*' ];
*/
function validate( opts, options ) {
if ( !isObject( options ) ) {
return new TypeError( 'invalid argument. Options must be an object. Value: `' + options + '`.' );
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
}
if ( hasOwnProp( options, 'thisArg' ) ) {
opts.thisArg = options.thisArg;
}
if ( hasOwnProp( options, 'returns' ) ) {
opts.returns = options.returns;
if ( indexOf( returns, opts.returns ) === -1 ) {
return new TypeError( 'invalid option. `returns` option must be one of the following: "' + returns.join( '", "' ) + '". Option: `' + opts.returns + '`.' );
return new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'returns', returns.join( '", "' ), opts.returns ) );
}
}
return null;
Expand Down
Loading

0 comments on commit c64ee37

Please sign in to comment.