From f15344cd7625c6fd83118ec348ae733ff4ee5631 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 24 Mar 2025 00:28:08 +0000 Subject: [PATCH] Transform error messages --- lib/main.js | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/main.js b/lib/main.js index 6ad824e..3cd50e0 100644 --- a/lib/main.js +++ b/lib/main.js @@ -33,7 +33,7 @@ var getOrder = require( '@stdlib/ndarray-order' ); var numel = require( '@stdlib/ndarray-base-numel' ); var nextCartesianIndex = require( '@stdlib/ndarray-base-next-cartesian-index' ).assign; var gcopy = require( '@stdlib/blas-base-gcopy' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -91,7 +91,7 @@ function filter( x, options, predicate, thisArg ) { var v; var i; if ( !isndarrayLike( x ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an ndarray-like object. Value: `%s`.', x ) ); + throw new TypeError( format( 'null5t', x ) ); } if ( arguments.length < 3 ) { clbk = options; @@ -111,11 +111,11 @@ function filter( x, options, predicate, thisArg ) { ctx = thisArg; } if ( !isFunction( clbk ) ) { - throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', clbk ) ); + throw new TypeError( format( 'null2b', clbk ) ); } if ( hasOpts ) { if ( !isPlainObject( opts ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) ); + throw new TypeError( format( 'null2V', opts ) ); } if ( hasOwnProp( opts, 'dtype' ) ) { dt = opts.dtype; @@ -124,7 +124,7 @@ function filter( x, options, predicate, thisArg ) { } if ( hasOwnProp( opts, 'order' ) ) { if ( !isOrder( opts.order ) ) { - throw new TypeError( format( 'invalid option. `%s` option must be a recognized order. Option: `%s`.', 'order', opts.order ) ); + throw new TypeError( format( 'null5C', 'order', opts.order ) ); } ord = opts.order; } @@ -135,7 +135,7 @@ function filter( x, options, predicate, thisArg ) { ctor = ctors( dt ); if ( ctor === null ) { // The only way we should get here is if the user provided an unsupported data type, as `getDType` should error if the input array has an unrecognized/unsupported data type... - throw new TypeError( format( 'invalid option. `%s` option must be a recognized data type. Option: `%s`.', 'dtype', opts.dtype ) ); + throw new TypeError( format( 'nullBf', 'dtype', opts.dtype ) ); } // Resolve the iteration order: if ( ord === void 0 ) { diff --git a/package.json b/package.json index 22065aa..a44b313 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,7 @@ "@stdlib/ndarray-dtype": "^0.2.2", "@stdlib/ndarray-order": "^0.2.2", "@stdlib/ndarray-shape": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" },