From 0f4e0fee4a11e566acf052d2b249b7cf5dc1c252 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 21 Apr 2025 00:31:15 +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 d3f2c26..3646288 100644 --- a/lib/main.js +++ b/lib/main.js @@ -33,7 +33,7 @@ var numel = require( '@stdlib/ndarray-base-numel' ); var slice = require( '@stdlib/ndarray-base-slice' ); var nextCartesianIndex = require( '@stdlib/ndarray-base-next-cartesian-index' ).assign; var args2multislice = require( '@stdlib/slice-base-args2multislice' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -94,7 +94,7 @@ function nditerRowEntries( x ) { var i; if ( !isndarrayLike( x ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) ); + throw new TypeError( format( '1lR4f', x ) ); } opts = { 'writable': false @@ -102,15 +102,15 @@ function nditerRowEntries( x ) { if ( arguments.length > 1 ) { options = arguments[ 1 ]; if ( !isPlainObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); + throw new TypeError( format( '1lR2V', options ) ); } if ( hasOwnProp( options, 'readonly' ) ) { if ( !isBoolean( options.readonly ) ) { - throw new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'readonly', options.readonly ) ); + throw new TypeError( format( '1lR2o', 'readonly', options.readonly ) ); } opts.writable = !options.readonly; if ( opts.writable && isReadOnly( x ) ) { - throw new Error( format( 'invalid option. Cannot write to read-only array.' ) ); + throw new Error( format( '1lRF4' ) ); } } } @@ -120,7 +120,7 @@ function nditerRowEntries( x ) { // Ensure that the input array has sufficient dimensions... if ( ndims < 2 ) { - throw new TypeError( 'invalid argument. First argument must be an ndarray having at least two dimensions.' ); + throw new TypeError( format('1lRF2') ); } // Check whether the input array is empty... diff --git a/package.json b/package.json index d42071a..c0bd3ab 100644 --- a/package.json +++ b/package.json @@ -48,7 +48,7 @@ "@stdlib/ndarray-base-slice": "^0.2.2", "@stdlib/ndarray-shape": "^0.2.2", "@stdlib/slice-base-args2multislice": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/symbol-iterator": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/utils-define-nonenumerable-read-only-property": "^0.2.2",