From c64ee37896b09957af9fb9e8c3957fb61f160380 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 15 Mar 2022 15:13:48 +0000 Subject: [PATCH] Auto-generated commit --- README.md | 14 +++++++------- async/any-by-right/lib/validate.js | 7 ++++--- async/any-by/lib/validate.js | 7 ++++--- async/bifurcate-by/lib/validate.js | 9 +++++---- async/count-by/lib/validate.js | 7 ++++--- async/every-by-right/lib/validate.js | 7 ++++--- async/every-by/lib/validate.js | 7 ++++--- async/for-each-right/lib/validate.js | 7 ++++--- async/for-each/lib/validate.js | 7 ++++--- async/group-by/lib/validate.js | 9 +++++---- async/none-by/lib/validate.js | 7 ++++--- bifurcate-by/lib/validate.js | 5 +++-- bifurcate-own/lib/validate.js | 5 +++-- bifurcate/lib/validate.js | 5 +++-- count-by/lib/validate.js | 3 ++- deep-get/lib/validate.js | 5 +++-- deep-pluck/lib/validate.js | 7 ++++--- deep-set/lib/validate.js | 7 ++++--- flatten-array/lib/validate.js | 7 ++++--- flatten-object/lib/validate.js | 11 ++++++----- group-by/lib/validate.js | 5 +++-- group-in/lib/validate.js | 5 +++-- group-own/lib/validate.js | 5 +++-- group/lib/validate.js | 5 +++-- package.json | 2 +- pluck/lib/validate.js | 5 +++-- tabulate-by/lib/validate.js | 3 ++- 27 files changed, 99 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index d2ee4a12..5c5284fd 100644 --- a/README.md +++ b/README.md @@ -427,13 +427,6 @@ 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/ @@ -441,6 +434,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [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 diff --git a/async/any-by-right/lib/validate.js b/async/any-by-right/lib/validate.js index 670106d7..5cc7b6aa 100644 --- a/async/any-by-right/lib/validate.js +++ b/async/any-by-right/lib/validate.js @@ -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 // @@ -53,7 +54,7 @@ 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; @@ -61,13 +62,13 @@ function validate( opts, options ) { 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; diff --git a/async/any-by/lib/validate.js b/async/any-by/lib/validate.js index 670106d7..5cc7b6aa 100644 --- a/async/any-by/lib/validate.js +++ b/async/any-by/lib/validate.js @@ -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 // @@ -53,7 +54,7 @@ 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; @@ -61,13 +62,13 @@ function validate( opts, options ) { 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; diff --git a/async/bifurcate-by/lib/validate.js b/async/bifurcate-by/lib/validate.js index e026db12..3a662f9e 100644 --- a/async/bifurcate-by/lib/validate.js +++ b/async/bifurcate-by/lib/validate.js @@ -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 // @@ -61,7 +62,7 @@ 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; @@ -69,19 +70,19 @@ function validate( opts, options ) { 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; diff --git a/async/count-by/lib/validate.js b/async/count-by/lib/validate.js index 670106d7..5cc7b6aa 100644 --- a/async/count-by/lib/validate.js +++ b/async/count-by/lib/validate.js @@ -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 // @@ -53,7 +54,7 @@ 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; @@ -61,13 +62,13 @@ function validate( opts, options ) { 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; diff --git a/async/every-by-right/lib/validate.js b/async/every-by-right/lib/validate.js index 670106d7..5cc7b6aa 100644 --- a/async/every-by-right/lib/validate.js +++ b/async/every-by-right/lib/validate.js @@ -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 // @@ -53,7 +54,7 @@ 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; @@ -61,13 +62,13 @@ function validate( opts, options ) { 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; diff --git a/async/every-by/lib/validate.js b/async/every-by/lib/validate.js index 670106d7..5cc7b6aa 100644 --- a/async/every-by/lib/validate.js +++ b/async/every-by/lib/validate.js @@ -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 // @@ -53,7 +54,7 @@ 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; @@ -61,13 +62,13 @@ function validate( opts, options ) { 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; diff --git a/async/for-each-right/lib/validate.js b/async/for-each-right/lib/validate.js index 670106d7..5cc7b6aa 100644 --- a/async/for-each-right/lib/validate.js +++ b/async/for-each-right/lib/validate.js @@ -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 // @@ -53,7 +54,7 @@ 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; @@ -61,13 +62,13 @@ function validate( opts, options ) { 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; diff --git a/async/for-each/lib/validate.js b/async/for-each/lib/validate.js index 670106d7..5cc7b6aa 100644 --- a/async/for-each/lib/validate.js +++ b/async/for-each/lib/validate.js @@ -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 // @@ -53,7 +54,7 @@ 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; @@ -61,13 +62,13 @@ function validate( opts, options ) { 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; diff --git a/async/group-by/lib/validate.js b/async/group-by/lib/validate.js index e026db12..3a662f9e 100644 --- a/async/group-by/lib/validate.js +++ b/async/group-by/lib/validate.js @@ -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 // @@ -61,7 +62,7 @@ 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; @@ -69,19 +70,19 @@ function validate( opts, options ) { 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; diff --git a/async/none-by/lib/validate.js b/async/none-by/lib/validate.js index 670106d7..5cc7b6aa 100644 --- a/async/none-by/lib/validate.js +++ b/async/none-by/lib/validate.js @@ -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 // @@ -53,7 +54,7 @@ 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; @@ -61,13 +62,13 @@ function validate( opts, options ) { 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; diff --git a/bifurcate-by/lib/validate.js b/bifurcate-by/lib/validate.js index ab68fbe8..1805d872 100644 --- a/bifurcate-by/lib/validate.js +++ b/bifurcate-by/lib/validate.js @@ -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 // @@ -55,7 +56,7 @@ 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; @@ -63,7 +64,7 @@ function validate( opts, options ) { 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; diff --git a/bifurcate-own/lib/validate.js b/bifurcate-own/lib/validate.js index 97439917..d28c036c 100644 --- a/bifurcate-own/lib/validate.js +++ b/bifurcate-own/lib/validate.js @@ -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 // @@ -55,7 +56,7 @@ var returns = [ 'values', 'keys', '*' ]; */ 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; @@ -63,7 +64,7 @@ function validate( opts, options ) { 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; diff --git a/bifurcate/lib/validate.js b/bifurcate/lib/validate.js index 05c4d408..f46a348f 100644 --- a/bifurcate/lib/validate.js +++ b/bifurcate/lib/validate.js @@ -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 // @@ -53,12 +54,12 @@ 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, '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; diff --git a/count-by/lib/validate.js b/count-by/lib/validate.js index eede0cf4..c8952d63 100644 --- a/count-by/lib/validate.js +++ b/count-by/lib/validate.js @@ -22,6 +22,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var format = require( '@stdlib/string/format' ); // MAIN // @@ -47,7 +48,7 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' ); */ 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; diff --git a/deep-get/lib/validate.js b/deep-get/lib/validate.js index bf1fa535..f8a36e96 100644 --- a/deep-get/lib/validate.js +++ b/deep-get/lib/validate.js @@ -23,6 +23,7 @@ var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var isObject = require( '@stdlib/assert/is-plain-object' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var format = require( '@stdlib/string/format' ); // MAIN // @@ -48,12 +49,12 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' ); */ function validate( opts, options ) { if ( !isObject( options ) ) { - return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); + return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); } if ( hasOwnProp( options, 'sep' ) ) { opts.sep = options.sep; if ( !isString( opts.sep ) ) { - return new TypeError( 'invalid option. `sep` option must be a string primitive. Option: `' + opts.sep + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a string primitive. Option: `%s`.', 'sep', opts.sep ) ); } } return null; diff --git a/deep-pluck/lib/validate.js b/deep-pluck/lib/validate.js index 277a9a72..178e668e 100644 --- a/deep-pluck/lib/validate.js +++ b/deep-pluck/lib/validate.js @@ -24,6 +24,7 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var isObject = require( '@stdlib/assert/is-plain-object' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var format = require( '@stdlib/string/format' ); // MAIN // @@ -51,18 +52,18 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' ); */ function validate( opts, options ) { if ( !isObject( options ) ) { - return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); + return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); } if ( hasOwnProp( options, 'copy' ) ) { opts.copy = options.copy; if ( !isBoolean( opts.copy ) ) { - return new TypeError( 'invalid option. `copy` option must be a boolean primitive. Option: `' + opts.copy + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'copy', opts.copy ) ); } } if ( hasOwnProp( options, 'sep' ) ) { opts.sep = options.sep; if ( !isString( opts.sep ) ) { - return new TypeError( 'invalid option. `sep` option must be a string primitive. Option: `' + opts.sep + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a string primitive. Option: `%s`.', 'sep', opts.sep ) ); } } return null; diff --git a/deep-set/lib/validate.js b/deep-set/lib/validate.js index 78f0761c..a7fb5f80 100644 --- a/deep-set/lib/validate.js +++ b/deep-set/lib/validate.js @@ -24,6 +24,7 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var isObject = require( '@stdlib/assert/is-plain-object' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var format = require( '@stdlib/string/format' ); // MAIN // @@ -50,18 +51,18 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' ); */ function validate( opts, options ) { if ( !isObject( options ) ) { - return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); + return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); } if ( hasOwnProp( options, 'create' ) ) { opts.create = options.create; if ( !isBoolean( opts.create ) ) { - return new TypeError( 'invalid option. `create` option must be a boolean primitive. Option: `' + opts.create + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'create', opts.create ) ); } } if ( hasOwnProp( options, 'sep' ) ) { opts.sep = options.sep; if ( !isString( opts.sep ) ) { - return new TypeError( 'invalid option. `sep` option must be a string primitive. Option: `' + opts.sep + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a string primitive. Option: `%s`.', 'sep', opts.sep ) ); } } return null; diff --git a/flatten-array/lib/validate.js b/flatten-array/lib/validate.js index e7dc1dfc..744b5cfc 100644 --- a/flatten-array/lib/validate.js +++ b/flatten-array/lib/validate.js @@ -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 isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; +var format = require( '@stdlib/string/format' ); // MAIN // @@ -51,18 +52,18 @@ var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).is */ function validate( opts, options ) { if ( !isObject( options ) ) { - return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); + return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); } if ( hasOwnProp( options, 'depth' ) ) { opts.depth = options.depth; if ( !isNonNegativeInteger( opts.depth ) ) { - return new TypeError( 'invalid option. `depth` option must be a nonnegative integer. Option: `' + opts.depth + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'depth', opts.depth ) ); } } if ( hasOwnProp( options, 'copy' ) ) { opts.copy = options.copy; if ( !isBoolean( opts.copy ) ) { - return new TypeError( 'invalid option. `copy` option must be a boolean primitive. Option: `' + opts.copy + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'copy', opts.copy ) ); } } return null; diff --git a/flatten-object/lib/validate.js b/flatten-object/lib/validate.js index 679e403f..46cadb1c 100644 --- a/flatten-object/lib/validate.js +++ b/flatten-object/lib/validate.js @@ -25,6 +25,7 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' ); var isString = require( '@stdlib/assert/is-string' ).isPrimitive; var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; +var format = require( '@stdlib/string/format' ); // MAIN // @@ -56,30 +57,30 @@ var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).is */ function validate( opts, options ) { if ( !isObject( options ) ) { - return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); + return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); } if ( hasOwnProp( options, 'depth' ) ) { opts.depth = options.depth; if ( !isNonNegativeInteger( opts.depth ) ) { - return new TypeError( 'invalid option. `depth` option must be a nonnegative integer. Option: `' + opts.depth + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a nonnegative integer. Option: `%s`.', 'depth', opts.depth ) ); } } if ( hasOwnProp( options, 'copy' ) ) { opts.copy = options.copy; if ( !isBoolean( opts.copy ) ) { - return new TypeError( 'invalid option. `copy` option must be a boolean primitive. Option: `' + opts.copy + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'copy', opts.copy ) ); } } if ( hasOwnProp( options, 'flattenArrays' ) ) { opts.flattenArrays = options.flattenArrays; if ( !isBoolean( opts.flattenArrays ) ) { - return new TypeError( 'invalid option. `flattenArrays` option must be a boolean primitive. Option: `' + opts.flattenArrays + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'flattenArrays', opts.flattenArrays ) ); } } if ( hasOwnProp( options, 'delimiter' ) ) { opts.delimiter = options.delimiter; if ( !isString( opts.delimiter ) ) { - return new TypeError( 'invalid option. `delimiter` option must be a string primitive. Option: `' + opts.delimiter + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a string primitive. Option: `%s`.', 'delimiter', opts.delimiter ) ); } } return null; diff --git a/group-by/lib/validate.js b/group-by/lib/validate.js index ab68fbe8..1805d872 100644 --- a/group-by/lib/validate.js +++ b/group-by/lib/validate.js @@ -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 // @@ -55,7 +56,7 @@ 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; @@ -63,7 +64,7 @@ function validate( opts, options ) { 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; diff --git a/group-in/lib/validate.js b/group-in/lib/validate.js index 97439917..d28c036c 100644 --- a/group-in/lib/validate.js +++ b/group-in/lib/validate.js @@ -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 // @@ -55,7 +56,7 @@ var returns = [ 'values', 'keys', '*' ]; */ 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; @@ -63,7 +64,7 @@ function validate( opts, options ) { 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; diff --git a/group-own/lib/validate.js b/group-own/lib/validate.js index 97439917..d28c036c 100644 --- a/group-own/lib/validate.js +++ b/group-own/lib/validate.js @@ -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 // @@ -55,7 +56,7 @@ var returns = [ 'values', 'keys', '*' ]; */ 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; @@ -63,7 +64,7 @@ function validate( opts, options ) { 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; diff --git a/group/lib/validate.js b/group/lib/validate.js index 05c4d408..f46a348f 100644 --- a/group/lib/validate.js +++ b/group/lib/validate.js @@ -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 // @@ -53,12 +54,12 @@ 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, '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; diff --git a/package.json b/package.json index 142d23f2..360b72e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@stdlib/utils", - "version": "0.0.12", + "version": "0.0.0", "description": "Standard utilities.", "license": "Apache-2.0", "author": { diff --git a/pluck/lib/validate.js b/pluck/lib/validate.js index 69d5ae63..db156c75 100644 --- a/pluck/lib/validate.js +++ b/pluck/lib/validate.js @@ -23,6 +23,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 format = require( '@stdlib/string/format' ); // MAIN // @@ -48,12 +49,12 @@ var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; */ function validate( opts, options ) { if ( !isObject( options ) ) { - return new TypeError( 'invalid argument. Options argument must be an object. Value: `' + options + '`.' ); + return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); } if ( hasOwnProp( options, 'copy' ) ) { opts.copy = options.copy; if ( !isBoolean( opts.copy ) ) { - return new TypeError( 'invalid option. `copy` option must be a boolean primitive. Option: `' + opts.copy + '`.' ); + return new TypeError( format( 'invalid option. `%s` option must be a boolean primitive. Option: `%s`.', 'copy', opts.copy ) ); } } return null; diff --git a/tabulate-by/lib/validate.js b/tabulate-by/lib/validate.js index eede0cf4..c8952d63 100644 --- a/tabulate-by/lib/validate.js +++ b/tabulate-by/lib/validate.js @@ -22,6 +22,7 @@ var isObject = require( '@stdlib/assert/is-plain-object' ); var hasOwnProp = require( '@stdlib/assert/has-own-property' ); +var format = require( '@stdlib/string/format' ); // MAIN // @@ -47,7 +48,7 @@ var hasOwnProp = require( '@stdlib/assert/has-own-property' ); */ 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;