8000 Transform error messages · stdlib-js/utils-group-by@bb795a2 · GitHub
[go: up one dir, main page]

Skip to content

Commit bb795a2

Browse files
committed
Transform error messages
1 parent 31a1ddd commit bb795a2

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lib/main.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var isCollection = require( '@stdlib/assert-is-collection' );
2424
var isFunction = require( '@stdlib/assert-is-function' );
25-
var format = require( '@stdlib/string-format' );
25+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2626
var validate = require( './validate.js' );
2727
var returnValues = require( './return_values.js' );
2828
var returnIndices = require( './return_indices.js' );
@@ -83,7 +83,7 @@ function groupBy( collection, options, indicator ) {
8383
var err;
8484
var cb;
8585
if ( !isCollection( collection ) ) {
86-
throw new TypeError( format( 'invalid argument. First argument must be a collection. Value: `%s`.', collection ) );
86+
throw new TypeError( format( '1UDAh', collection ) );
8787
}
8888
opts = {
8989
'returns': 'values'
@@ -98,7 +98,7 @@ function groupBy( collection, options, indicator ) {
9898
cb = indicator;
9999
}
100100
if ( !isFunction( cb ) ) {
101-
throw new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', cb ) );
101+
throw new TypeError( format( '1UD3q', cb ) );
102102
}
103103
if ( opts.returns === 'values' ) {
104104
return returnValues( collection, opts, cb );

lib/validate.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
var isObject = require( '@stdlib/assert-is-plain-object' );
2424
var hasOwnProp = require( '@stdlib/assert-has-own-property' );
2525
var indexOf = require( '@stdlib/utils-index-of' );
26-
var format = require( '@stdlib/string-format' );
26+
var format = require( '@stdlib/error-tools-fmtprodmsg' );
2727

2828

2929
// VARIABLES //
@@ -56,15 +56,15 @@ var returns = [ 'values', 'indices', '*' ];
5656
*/
5757
function validate( opts, options ) {
5858
if ( !isObject( options ) ) {
59-
return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
59+
return new TypeError( format( '1UD2V', options ) );
6060
}
6161
if ( hasOwnProp( options, 'thisArg' ) ) {
6262
opts.thisArg = options.thisArg;
6363
}
6464
if ( hasOwnProp( options, 'returns' ) ) {
6565
opts.returns = options.returns;
6666
if ( indexOf( returns, opts.returns ) === -1 ) {
67-
return new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Option: `%s`.', 'returns', returns.join( '", "' ), opts.returns ) );
67+
return new TypeError( format( '1UD4S', 'returns', returns.join( '", "' ), opts.returns ) );
6868
}
6969
}
7070
return null;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"@stdlib/assert-is-collection": "^0.2.2",
4242
"@stdlib/assert-is-function": "^0.2.2",
4343
"@stdlib/assert-is-plain-object": "^0.2.2",
44-
"@stdlib/string-format": "^0.2.2",
44+
"@stdlib/error-tools-fmtprodmsg": "^0.2.2",
4545
"@stdlib/types": "^0.4.1",
4646
3D98 "@stdlib/utils-index-of": "^0.2.2",
4747
"@stdlib/error-tools-fmtprodmsg": "^0.2.2"

0 commit comments

Comments
 (0)
0