From 2ef1fd3b1c96a74eb819fa127f359a5d94fea0ee Mon Sep 17 00:00:00 2001 From: Philipp Burckhardt Date: Fri, 10 Jul 2026 01:09:45 -0500 Subject: [PATCH] style: disallow `format` calls without interpolation placeholders --- etc/eslint/rules/style.js | 6 ++++++ lib/node_modules/@stdlib/array/mskfilter/lib/main.js | 2 +- lib/node_modules/@stdlib/array/mskreject/lib/main.js | 2 +- lib/node_modules/@stdlib/array/struct-factory/lib/main.js | 4 ++-- lib/node_modules/@stdlib/array/to-fancy/lib/prop2slice.js | 2 +- .../@stdlib/array/to-fancy/lib/resolve_index.js | 3 +-- lib/node_modules/@stdlib/blas/ddot/lib/main.js | 4 ++-- lib/node_modules/@stdlib/blas/ext/cusum/lib/assign.js | 4 ++-- lib/node_modules/@stdlib/blas/ext/cusum/lib/main.js | 4 ++-- lib/node_modules/@stdlib/blas/sdot/lib/main.js | 4 ++-- .../@stdlib/blas/tools/swap-factory/lib/main.js | 4 ++-- .../base/binary-reduce-strided1d-dispatch/lib/main.js | 6 +++--- .../@stdlib/ndarray/base/every/scripts/predicate_loops.js | 2 +- .../ndarray/base/nullary-strided1d-dispatch/lib/main.js | 6 +++--- .../@stdlib/ndarray/base/nullary/scripts/loops.js | 2 +- .../base/unary-reduce-strided1d-dispatch-by/lib/main.js | 6 +++--- .../base/unary-reduce-strided1d-dispatch/lib/main.js | 6 +++--- .../ndarray/base/unary-strided1d-dispatch/lib/main.js | 6 +++--- .../@stdlib/ndarray/iter/column-entries/lib/main.js | 2 +- lib/node_modules/@stdlib/ndarray/iter/columns/lib/main.js | 2 +- lib/node_modules/@stdlib/ndarray/iter/matrices/lib/main.js | 2 +- .../@stdlib/ndarray/iter/matrix-entries/lib/main.js | 2 +- .../@stdlib/ndarray/iter/row-entries/lib/main.js | 2 +- lib/node_modules/@stdlib/ndarray/iter/rows/lib/main.js | 2 +- .../@stdlib/ndarray/iter/select-dimension/lib/main.js | 2 +- lib/node_modules/@stdlib/ndarray/iter/stacks/lib/main.js | 2 +- lib/node_modules/@stdlib/ndarray/iter/subarrays/lib/main.js | 2 +- .../@stdlib/ndarray/to-fancy/lib/resolve_index.js | 3 +-- lib/node_modules/@stdlib/stats/array/mskmax/lib/main.js | 2 +- lib/node_modules/@stdlib/stats/array/mskmaxabs/lib/main.js | 2 +- .../@stdlib/stats/array/mskmidrange/lib/main.js | 2 +- lib/node_modules/@stdlib/stats/array/mskmin/lib/main.js | 2 +- lib/node_modules/@stdlib/stats/array/mskminabs/lib/main.js | 2 +- lib/node_modules/@stdlib/stats/array/mskrange/lib/main.js | 2 +- lib/node_modules/@stdlib/stats/array/nanmskmax/lib/main.js | 2 +- .../@stdlib/stats/array/nanmskmidrange/lib/main.js | 2 +- lib/node_modules/@stdlib/stats/array/nanmskmin/lib/main.js | 2 +- .../@stdlib/stats/array/nanmskrange/lib/main.js | 2 +- 38 files changed, 59 insertions(+), 55 deletions(-) diff --git a/etc/eslint/rules/style.js b/etc/eslint/rules/style.js index 72abd16d140c..9a68a8196495 100644 --- a/etc/eslint/rules/style.js +++ b/etc/eslint/rules/style.js @@ -1371,6 +1371,12 @@ rules[ 'no-restricted-syntax' ] = [ 'error', { 'selector': 'CallExpression[callee.object.name="path"][callee.property.name="extname"]', 'message': 'Use `@stdlib/utils/extname` instead of path.extname.' + }, + + // format without interpolation + { + 'selector': 'CallExpression[callee.name="format"][arguments.length=1][arguments.0.value=/^[^%]*$/]', + 'message': 'Unnecessary `format` call. Remove `format` when a string does not contain interpolation placeholders.' } ]; diff --git a/lib/node_modules/@stdlib/array/mskfilter/lib/main.js b/lib/node_modules/@stdlib/array/mskfilter/lib/main.js index d846c9656034..804a2b15a516 100644 --- a/lib/node_modules/@stdlib/array/mskfilter/lib/main.js +++ b/lib/node_modules/@stdlib/array/mskfilter/lib/main.js @@ -65,7 +65,7 @@ function mskfilter( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', mask ) ); } if ( x.length !== mask.length ) { - throw new Error( format( 'invalid arguments. Must provide equal length array-like objects.' ) ); + throw new Error( 'invalid arguments. Must provide equal length array-like objects.' ); } dt = dtype( x ); if ( dt === 'generic' || dt === null ) { diff --git a/lib/node_modules/@stdlib/array/mskreject/lib/main.js b/lib/node_modules/@stdlib/array/mskreject/lib/main.js index 3313cbf90dae..2315c43c3035 100644 --- a/lib/node_modules/@stdlib/array/mskreject/lib/main.js +++ b/lib/node_modules/@stdlib/array/mskreject/lib/main.js @@ -65,7 +65,7 @@ function mskreject( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', mask ) ); } if ( x.length !== mask.length ) { - throw new Error( format( 'invalid arguments. Must provide equal length array-like objects.' ) ); + throw new Error( 'invalid arguments. Must provide equal length array-like objects.' ); } dt = dtype( x ); if ( dt === 'generic' || dt === null ) { diff --git a/lib/node_modules/@stdlib/array/struct-factory/lib/main.js b/lib/node_modules/@stdlib/array/struct-factory/lib/main.js index 90d4b1e822eb..b54a3877c2f1 100644 --- a/lib/node_modules/@stdlib/array/struct-factory/lib/main.js +++ b/lib/node_modules/@stdlib/array/struct-factory/lib/main.js @@ -208,7 +208,7 @@ function factory( arg ) { // eslint-disable-line stdlib/jsdoc-require-throws-tag len = arg.length; buf = fromArray( Struct, new ArrayBuffer( len*BYTES_PER_ELEMENT ), arg ); if ( buf === null ) { - throw new TypeError( format( 'invalid argument. Each element of a provided input array must be a valid object or a struct instance having the same layout as elements in the desired output array.' ) ); + throw new TypeError( 'invalid argument. Each element of a provided input array must be a valid object or a struct instance having the same layout as elements in the desired output array.' ); } } // Case: new StructArray( ArrayBuffer ) @@ -235,7 +235,7 @@ function factory( arg ) { // eslint-disable-line stdlib/jsdoc-require-throws-tag len = tmp.length; buf = fromArray( Struct, new ArrayBuffer( len*BYTES_PER_ELEMENT ), tmp ); if ( buf === null ) { - throw new TypeError( format( 'invalid argument. Each element of a provided input iterable must be either a valid object or a struct instance having the same layout as elements in the desired output array.' ) ); + throw new TypeError( 'invalid argument. Each element of a provided input iterable must be either a valid object or a struct instance having the same layout as elements in the desired output array.' ); } } // Case: new StructArray( ???? ) diff --git a/lib/node_modules/@stdlib/array/to-fancy/lib/prop2slice.js b/lib/node_modules/@stdlib/array/to-fancy/lib/prop2slice.js index 5d01a86322a7..43cb1f9e5307 100644 --- a/lib/node_modules/@stdlib/array/to-fancy/lib/prop2slice.js +++ b/lib/node_modules/@stdlib/array/to-fancy/lib/prop2slice.js @@ -122,7 +122,7 @@ function parseSubsequence( raw, str, max, strict ) { // NOTE: the following error check must come last due to fall-through when in non-strict mode... if ( s.code === 'ERR_SLICE_OUT_OF_BOUNDS' ) { if ( strict ) { - throw new RangeError( format( 'invalid operation. Slice exceeds array bounds.' ) ); + throw new RangeError( 'invalid operation. Slice exceeds array bounds.' ); } // Repeat parsing, this time allowing for out-of-bounds slices: s = seq2slice( str, max, false ); diff --git a/lib/node_modules/@stdlib/array/to-fancy/lib/resolve_index.js b/lib/node_modules/@stdlib/array/to-fancy/lib/resolve_index.js index a5861dd64bcf..39f3331da132 100644 --- a/lib/node_modules/@stdlib/array/to-fancy/lib/resolve_index.js +++ b/lib/node_modules/@stdlib/array/to-fancy/lib/resolve_index.js @@ -21,7 +21,6 @@ // MODULES // var normalizeIndex = require( '@stdlib/ndarray/base/normalize-index' ); -var format = require( '@stdlib/string/format' ); // MAIN // @@ -52,7 +51,7 @@ function resolveIndex( str, max, strict ) { i = normalizeIndex( idx, max-1 ); if ( i === -1 ) { if ( strict ) { - throw new RangeError( format( 'invalid operation. Index exceeds array bounds.' ) ); + throw new RangeError( 'invalid operation. Index exceeds array bounds.' ); } // Return the non-normalized index, as this should fallback to default property handling and returning "undefined": return idx; diff --git a/lib/node_modules/@stdlib/blas/ddot/lib/main.js b/lib/node_modules/@stdlib/blas/ddot/lib/main.js index a5a24aa38893..6a949bf81148 100644 --- a/lib/node_modules/@stdlib/blas/ddot/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ddot/lib/main.js @@ -96,10 +96,10 @@ function ddot( x, y ) { // Validate that we've been provided non-zero-dimensional arrays... if ( xsh.length < 1 ) { - throw new TypeError( format( 'invalid argument. First argument must have at least one dimension.' ) ); + throw new TypeError( 'invalid argument. First argument must have at least one dimension.' ); } if ( ysh.length < 1 ) { - throw new TypeError( format( 'invalid argument. Second argument must have at least one dimension.' ) ); + throw new TypeError( 'invalid argument. Second argument must have at least one dimension.' ); } // Validate that the dimension argument is a negative integer... if ( arguments.length > 2 ) { diff --git a/lib/node_modules/@stdlib/blas/ext/cusum/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/cusum/lib/assign.js index 7620a615dde8..bb02b9ffb2e5 100644 --- a/lib/node_modules/@stdlib/blas/ext/cusum/lib/assign.js +++ b/lib/node_modules/@stdlib/blas/ext/cusum/lib/assign.js @@ -114,7 +114,7 @@ function assign( x ) { if ( isndarrayLike( v ) ) { // As the operation is performed across all dimensions, `v` is assumed to be a zero-dimensional ndarray... if ( ndims( v ) !== 0 ) { - throw new TypeError( format( 'invalid argument. Second argument must be a zero-dimensional ndarray.' ) ); + throw new TypeError( 'invalid argument. Second argument must be a zero-dimensional ndarray.' ); } return base( x, v, out ); } @@ -142,7 +142,7 @@ function assign( x ) { if ( hasOwnProp( opts, 'dims' ) ) { v = maybeBroadcastArray( v, nonCoreShape( getShape( x ), opts.dims ) ); // eslint-disable-line max-len } else if ( ndims( v ) !== 0 ) { - throw new TypeError( format( 'invalid argument. Second argument must be a zero-dimensional ndarray.' ) ); + throw new TypeError( 'invalid argument. Second argument must be a zero-dimensional ndarray.' ); } } // Case: assign( x, initial_scalar, out, opts ) diff --git a/lib/node_modules/@stdlib/blas/ext/cusum/lib/main.js b/lib/node_modules/@stdlib/blas/ext/cusum/lib/main.js index 6dbe4ece3d1c..623d6851decc 100644 --- a/lib/node_modules/@stdlib/blas/ext/cusum/lib/main.js +++ b/lib/node_modules/@stdlib/blas/ext/cusum/lib/main.js @@ -102,7 +102,7 @@ function cusum( x ) { if ( isndarrayLike( v ) ) { // As the operation is performed across all dimensions, `v` must be a zero-dimensional ndarray... if ( ndims( v ) !== 0 ) { - throw new TypeError( format( 'invalid argument. Second argument must be a zero-dimensional ndarray.' ) ); + throw new TypeError( 'invalid argument. Second argument must be a zero-dimensional ndarray.' ); } return base( x, v ); } @@ -126,7 +126,7 @@ function cusum( x ) { if ( hasOwnProp( opts, 'dims' ) ) { v = maybeBroadcastArray( v, nonCoreShape( getShape( x ), opts.dims ) ); // eslint-disable-line max-len } else if ( ndims( v ) !== 0 ) { - throw new TypeError( format( 'invalid argument. Second argument must be a zero-dimensional ndarray.' ) ); + throw new TypeError( 'invalid argument. Second argument must be a zero-dimensional ndarray.' ); } } // Case: cusum( x, initial_scalar, opts ) diff --git a/lib/node_modules/@stdlib/blas/sdot/lib/main.js b/lib/node_modules/@stdlib/blas/sdot/lib/main.js index 1778559b2e57..f11da7279065 100644 --- a/lib/node_modules/@stdlib/blas/sdot/lib/main.js +++ b/lib/node_modules/@stdlib/blas/sdot/lib/main.js @@ -96,10 +96,10 @@ function sdot( x, y ) { // Validate that we've been provided non-zero-dimensional arrays... if ( xsh.length < 1 ) { - throw new TypeError( format( 'invalid argument. First argument must have at least one dimension.' ) ); + throw new TypeError( 'invalid argument. First argument must have at least one dimension.' ); } if ( ysh.length < 1 ) { - throw new TypeError( format( 'invalid argument. Second argument must have at least one dimension.' ) ); + throw new TypeError( 'invalid argument. Second argument must have at least one dimension.' ); } // Validate that the dimension argument is a negative integer... if ( arguments.length > 2 ) { diff --git a/lib/node_modules/@stdlib/blas/tools/swap-factory/lib/main.js b/lib/node_modules/@stdlib/blas/tools/swap-factory/lib/main.js index 5825db00cfeb..4332a684868e 100644 --- a/lib/node_modules/@stdlib/blas/tools/swap-factory/lib/main.js +++ b/lib/node_modules/@stdlib/blas/tools/swap-factory/lib/main.js @@ -136,10 +136,10 @@ function factory( base, dtype ) { // Validate that we've been provided non-zero-dimensional arrays... if ( xsh.length < 1 ) { - throw new TypeError( format( 'invalid argument. First argument must have at least one dimension.' ) ); + throw new TypeError( 'invalid argument. First argument must have at least one dimension.' ); } if ( ysh.length < 1 ) { - throw new TypeError( format( 'invalid argument. Second argument must have at least one dimension.' ) ); + throw new TypeError( 'invalid argument. Second argument must have at least one dimension.' ); } // Validate that the arrays have the same shape... if ( !hasEqualValues( xsh, ysh ) ) { diff --git a/lib/node_modules/@stdlib/ndarray/base/binary-reduce-strided1d-dispatch/lib/main.js b/lib/node_modules/@stdlib/ndarray/base/binary-reduce-strided1d-dispatch/lib/main.js index 41a0e33c370a..8f755a1fff5d 100644 --- a/lib/node_modules/@stdlib/ndarray/base/binary-reduce-strided1d-dispatch/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/base/binary-reduce-strided1d-dispatch/lib/main.js @@ -128,13 +128,13 @@ function BinaryStrided1dDispatch( table, idtypes, odtypes, policies ) { throw new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', table ) ); } if ( !isFunction( table.default ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "default" property and an associated method.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "default" property and an associated method.' ); } if ( hasProp( table, 'types' ) && !isCollection( table.types ) && !isEmptyCollection( table.types ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "types" property whose associated value is an array-like object.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "types" property whose associated value is an array-like object.' ); } if ( hasProp( table, 'fcns' ) && !isFunctionArray( table.fcns ) && !isEmptyCollection( table.fcns ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "fcns" property whose associated value is an array-like object containing functions.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "fcns" property whose associated value is an array-like object containing functions.' ); } if ( !isCollection( idtypes ) ) { throw new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', idtypes ) ); diff --git a/lib/node_modules/@stdlib/ndarray/base/every/scripts/predicate_loops.js b/lib/node_modules/@stdlib/ndarray/base/every/scripts/predicate_loops.js index b513a2f712f2..d25b7c72cf56 100644 --- a/lib/node_modules/@stdlib/ndarray/base/every/scripts/predicate_loops.js +++ b/lib/node_modules/@stdlib/ndarray/base/every/scripts/predicate_loops.js @@ -347,7 +347,7 @@ function createSourceFile( signature ) { tmp = format( 'f( (%s)v )', ct1 ); } } else { // e.g., c, z, f, d, b, etc - tmp = format( 'f( v )' ); + tmp = 'f( v )'; } file = replace( file, '{{CALLBACK_EXPRESSION_0D}}', tmp ); diff --git a/lib/node_modules/@stdlib/ndarray/base/nullary-strided1d-dispatch/lib/main.js b/lib/node_modules/@stdlib/ndarray/base/nullary-strided1d-dispatch/lib/main.js index 488bf95a7cc3..b42ad5422b25 100644 --- a/lib/node_modules/@stdlib/ndarray/base/nullary-strided1d-dispatch/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/base/nullary-strided1d-dispatch/lib/main.js @@ -110,13 +110,13 @@ function NullaryStrided1dDispatch( table, idtypes, odtypes, options ) { throw new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', table ) ); } if ( !isFunction( table.default ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "default" property and an associated method.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "default" property and an associated method.' ); } if ( hasProp( table, 'types' ) && !isCollection( table.types ) && !isEmptyCollection( table.types ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "types" property whose associated value is an array-like object.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "types" property whose associated value is an array-like object.' ); } if ( hasProp( table, 'fcns' ) && !isFunctionArray( table.fcns ) && !isEmptyCollection( table.fcns ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "fcns" property whose associated value is an array-like object containing functions.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "fcns" property whose associated value is an array-like object containing functions.' ); } if ( !isCollection( idtypes ) ) { throw new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', idtypes ) ); diff --git a/lib/node_modules/@stdlib/ndarray/base/nullary/scripts/loops.js b/lib/node_modules/@stdlib/ndarray/base/nullary/scripts/loops.js index d2bbe68ffb6d..530d60f86533 100644 --- a/lib/node_modules/@stdlib/ndarray/base/nullary/scripts/loops.js +++ b/lib/node_modules/@stdlib/ndarray/base/nullary/scripts/loops.js @@ -561,7 +561,7 @@ function createSourceFile( signature ) { tmp = format( '(%s)f()', dtype2c( t1 ) ); } } else { // e.g., c, z, f, d, b, etc - tmp = format( 'f()' ); + tmp = 'f()'; } file = replace( file, '{{CALLBACK_EXPRESSION_0D}}', tmp ); diff --git a/lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d-dispatch-by/lib/main.js b/lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d-dispatch-by/lib/main.js index 1a53c4dc1889..1993fdba0c9f 100644 --- a/lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d-dispatch-by/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d-dispatch-by/lib/main.js @@ -126,13 +126,13 @@ function UnaryStrided1dDispatchBy( table, idtypes, odtypes, policies ) { throw new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', table ) ); } if ( !isFunction( table.default ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "default" property and an associated method.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "default" property and an associated method.' ); } if ( hasProp( table, 'types' ) && !isCollection( table.types ) && !isEmptyCollection( table.types ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "types" property whose associated value is an array-like object.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "types" property whose associated value is an array-like object.' ); } if ( hasProp( table, 'fcns' ) && !isFunctionArray( table.fcns ) && !isEmptyCollection( table.fcns ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "fcns" property whose associated value is an array-like object containing functions.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "fcns" property whose associated value is an array-like object containing functions.' ); } if ( !isCollection( idtypes ) ) { throw new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', idtypes ) ); diff --git a/lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d-dispatch/lib/main.js b/lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d-dispatch/lib/main.js index c3ee66fa963f..8ee8f0ce595c 100644 --- a/lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d-dispatch/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/base/unary-reduce-strided1d-dispatch/lib/main.js @@ -122,13 +122,13 @@ function UnaryStrided1dDispatch( table, idtypes, odtypes, policies ) { throw new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', table ) ); } if ( !isFunction( table.default ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "default" property and an associated method.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "default" property and an associated method.' ); } if ( hasProp( table, 'types' ) && !isCollection( table.types ) && !isEmptyCollection( table.types ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "types" property whose associated value is an array-like object.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "types" property whose associated value is an array-like object.' ); } if ( hasProp( table, 'fcns' ) && !isFunctionArray( table.fcns ) && !isEmptyCollection( table.fcns ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "fcns" property whose associated value is an array-like object containing functions.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "fcns" property whose associated value is an array-like object containing functions.' ); } if ( !isCollection( idtypes ) ) { throw new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', idtypes ) ); diff --git a/lib/node_modules/@stdlib/ndarray/base/unary-strided1d-dispatch/lib/main.js b/lib/node_modules/@stdlib/ndarray/base/unary-strided1d-dispatch/lib/main.js index 020aa6ef6d16..4b50bd9bf9c3 100644 --- a/lib/node_modules/@stdlib/ndarray/base/unary-strided1d-dispatch/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/base/unary-strided1d-dispatch/lib/main.js @@ -127,13 +127,13 @@ function UnaryStrided1dDispatch( table, idtypes, odtypes, policies, options ) { throw new TypeError( format( 'invalid argument. First argument must be an object. Value: `%s`.', table ) ); } if ( !isFunction( table.default ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "default" property and an associated method.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "default" property and an associated method.' ); } if ( hasProp( table, 'types' ) && !isCollection( table.types ) && !isEmptyCollection( table.types ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "types" property whose associated value is an array-like object.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "types" property whose associated value is an array-like object.' ); } if ( hasProp( table, 'fcns' ) && !isFunctionArray( table.fcns ) && !isEmptyCollection( table.fcns ) ) { - throw new TypeError( format( 'invalid argument. First argument must be an object having a "fcns" property whose associated value is an array-like object containing functions.' ) ); + throw new TypeError( 'invalid argument. First argument must be an object having a "fcns" property whose associated value is an array-like object containing functions.' ); } if ( !isCollection( idtypes ) ) { throw new TypeError( format( 'invalid argument. Second argument must be an array-like object. Value: `%s`.', idtypes ) ); diff --git a/lib/node_modules/@stdlib/ndarray/iter/column-entries/lib/main.js b/lib/node_modules/@stdlib/ndarray/iter/column-entries/lib/main.js index fd7b8c3e50a3..5bf4080421e9 100644 --- a/lib/node_modules/@stdlib/ndarray/iter/column-entries/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/iter/column-entries/lib/main.js @@ -110,7 +110,7 @@ function nditerColumnEntries( x ) { } opts.writable = !options.readonly; if ( opts.writable && isReadOnly( x ) ) { - throw new Error( format( 'invalid option. Cannot write to read-only array.' ) ); + throw new Error( 'invalid option. Cannot write to read-only array.' ); } } } diff --git a/lib/node_modules/@stdlib/ndarray/iter/columns/lib/main.js b/lib/node_modules/@stdlib/ndarray/iter/columns/lib/main.js index c0743073434e..c2e8a2d5d633 100644 --- a/lib/node_modules/@stdlib/ndarray/iter/columns/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/iter/columns/lib/main.js @@ -110,7 +110,7 @@ function nditerColumns( x ) { } opts.writable = !options.readonly; if ( opts.writable && isReadOnly( x ) ) { - throw new Error( format( 'invalid option. Cannot write to read-only array.' ) ); + throw new Error( 'invalid option. Cannot write to read-only array.' ); } } } diff --git a/lib/node_modules/@stdlib/ndarray/iter/matrices/lib/main.js b/lib/node_modules/@stdlib/ndarray/iter/matrices/lib/main.js index 517c2a210e26..bba30e21b6bd 100644 --- a/lib/node_modules/@stdlib/ndarray/iter/matrices/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/iter/matrices/lib/main.js @@ -104,7 +104,7 @@ function nditerMatrices( x ) { } opts.writable = !options.readonly; if ( opts.writable && isReadOnly( x ) ) { - throw new Error( format( 'invalid option. Cannot write to read-only array.' ) ); + throw new Error( 'invalid option. Cannot write to read-only array.' ); } } } diff --git a/lib/node_modules/@stdlib/ndarray/iter/matrix-entries/lib/main.js b/lib/node_modules/@stdlib/ndarray/iter/matrix-entries/lib/main.js index 294cabf77c43..d897057782f6 100644 --- a/lib/node_modules/@stdlib/ndarray/iter/matrix-entries/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/iter/matrix-entries/lib/main.js @@ -110,7 +110,7 @@ function nditerMatrixEntries( x ) { } opts.writable = !options.readonly; if ( opts.writable && isReadOnly( x ) ) { - throw new Error( format( 'invalid option. Cannot write to read-only array.' ) ); + throw new Error( 'invalid option. Cannot write to read-only array.' ); } } } diff --git a/lib/node_modules/@stdlib/ndarray/iter/row-entries/lib/main.js b/lib/node_modules/@stdlib/ndarray/iter/row-entries/lib/main.js index 9e713ea1c967..38e6831108ca 100644 --- a/lib/node_modules/@stdlib/ndarray/iter/row-entries/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/iter/row-entries/lib/main.js @@ -110,7 +110,7 @@ function nditerRowEntries( x ) { } opts.writable = !options.readonly; if ( opts.writable && isReadOnly( x ) ) { - throw new Error( format( 'invalid option. Cannot write to read-only array.' ) ); + throw new Error( 'invalid option. Cannot write to read-only array.' ); } } } diff --git a/lib/node_modules/@stdlib/ndarray/iter/rows/lib/main.js b/lib/node_modules/@stdlib/ndarray/iter/rows/lib/main.js index 2e5ef326fdd5..89391608f1e1 100644 --- a/lib/node_modules/@stdlib/ndarray/iter/rows/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/iter/rows/lib/main.js @@ -110,7 +110,7 @@ function nditerRows( x ) { } opts.writable = !options.readonly; if ( opts.writable && isReadOnly( x ) ) { - throw new Error( format( 'invalid option. Cannot write to read-only array.' ) ); + throw new Error( 'invalid option. Cannot write to read-only array.' ); } } } diff --git a/lib/node_modules/@stdlib/ndarray/iter/select-dimension/lib/main.js b/lib/node_modules/@stdlib/ndarray/iter/select-dimension/lib/main.js index 811b87c9ad4b..6010ba627372 100644 --- a/lib/node_modules/@stdlib/ndarray/iter/select-dimension/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/iter/select-dimension/lib/main.js @@ -112,7 +112,7 @@ function nditerSelectDimension( x, dim ) { } opts.writable = !options.readonly; if ( opts.writable && isReadOnly( x ) ) { - throw new Error( format( 'invalid option. Cannot write to read-only array.' ) ); + throw new Error( 'invalid option. Cannot write to read-only array.' ); } } if ( hasOwnProp( options, 'keepdim' ) ) { diff --git a/lib/node_modules/@stdlib/ndarray/iter/stacks/lib/main.js b/lib/node_modules/@stdlib/ndarray/iter/stacks/lib/main.js index 24efb1abdcf1..e1b0de96d4a6 100644 --- a/lib/node_modules/@stdlib/ndarray/iter/stacks/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/iter/stacks/lib/main.js @@ -115,7 +115,7 @@ function nditerStacks( x, dims ) { } opts.writable = !options.readonly; if ( opts.writable && isReadOnly( x ) ) { - throw new Error( format( 'invalid option. Cannot write to read-only array.' ) ); + throw new Error( 'invalid option. Cannot write to read-only array.' ); } } } diff --git a/lib/node_modules/@stdlib/ndarray/iter/subarrays/lib/main.js b/lib/node_modules/@stdlib/ndarray/iter/subarrays/lib/main.js index fa46ba4b1a18..19dd72b939f2 100644 --- a/lib/node_modules/@stdlib/ndarray/iter/subarrays/lib/main.js +++ b/lib/node_modules/@stdlib/ndarray/iter/subarrays/lib/main.js @@ -110,7 +110,7 @@ function nditerSubarrays( x, ndims ) { } opts.writable = !options.readonly; if ( opts.writable && isReadOnly( x ) ) { - throw new Error( format( 'invalid option. Cannot write to read-only array.' ) ); + throw new Error( 'invalid option. Cannot write to read-only array.' ); } } } diff --git a/lib/node_modules/@stdlib/ndarray/to-fancy/lib/resolve_index.js b/lib/node_modules/@stdlib/ndarray/to-fancy/lib/resolve_index.js index 131a4b407c63..ed52e052bd2c 100644 --- a/lib/node_modules/@stdlib/ndarray/to-fancy/lib/resolve_index.js +++ b/lib/node_modules/@stdlib/ndarray/to-fancy/lib/resolve_index.js @@ -21,7 +21,6 @@ // MODULES // var normalizeIndex = require( '@stdlib/ndarray/base/normalize-index' ); -var format = require( '@stdlib/string/format' ); // MAIN // @@ -55,7 +54,7 @@ function resolveIndex( str, max, strict ) { idx = parseInt( str, 10 ); i = normalizeIndex( idx, max-1 ); if ( i === -1 && strict ) { - throw new RangeError( format( 'invalid operation. Index exceeds ndarray bounds.' ) ); + throw new RangeError( 'invalid operation. Index exceeds ndarray bounds.' ); } return i; } diff --git a/lib/node_modules/@stdlib/stats/array/mskmax/lib/main.js b/lib/node_modules/@stdlib/stats/array/mskmax/lib/main.js index 79fe54fc3040..94554578afd7 100644 --- a/lib/node_modules/@stdlib/stats/array/mskmax/lib/main.js +++ b/lib/node_modules/@stdlib/stats/array/mskmax/lib/main.js @@ -73,7 +73,7 @@ function mskmax( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( IDTYPES, '", "' ), dt ) ); } if ( x.length !== mask.length ) { - throw new RangeError( format( 'invalid arguments. First and second arguments must have the same length.' ) ); + throw new RangeError( 'invalid arguments. First and second arguments must have the same length.' ); } return strided( x.length, x, 1, 0, mask, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/stats/array/mskmaxabs/lib/main.js b/lib/node_modules/@stdlib/stats/array/mskmaxabs/lib/main.js index 7b3b93e4108e..b3535e3425c7 100644 --- a/lib/node_modules/@stdlib/stats/array/mskmaxabs/lib/main.js +++ b/lib/node_modules/@stdlib/stats/array/mskmaxabs/lib/main.js @@ -73,7 +73,7 @@ function mskmaxabs( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( IDTYPES, '", "' ), dt ) ); } if ( x.length !== mask.length ) { - throw new RangeError( format( 'invalid arguments. First and second arguments must have the same length.' ) ); + throw new RangeError( 'invalid arguments. First and second arguments must have the same length.' ); } return strided( x.length, x, 1, 0, mask, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/stats/array/mskmidrange/lib/main.js b/lib/node_modules/@stdlib/stats/array/mskmidrange/lib/main.js index 175a5c1d24de..87a0c760f613 100644 --- a/lib/node_modules/@stdlib/stats/array/mskmidrange/lib/main.js +++ b/lib/node_modules/@stdlib/stats/array/mskmidrange/lib/main.js @@ -73,7 +73,7 @@ function mskmidrange( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( IDTYPES, '", "' ), dt ) ); } if ( x.length !== mask.length ) { - throw new RangeError( format( 'invalid arguments. First and second arguments must have the same length.' ) ); + throw new RangeError( 'invalid arguments. First and second arguments must have the same length.' ); } return strided( x.length, x, 1, 0, mask, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/stats/array/mskmin/lib/main.js b/lib/node_modules/@stdlib/stats/array/mskmin/lib/main.js index cba9b05fb3a4..94be6dc98d35 100644 --- a/lib/node_modules/@stdlib/stats/array/mskmin/lib/main.js +++ b/lib/node_modules/@stdlib/stats/array/mskmin/lib/main.js @@ -73,7 +73,7 @@ function mskmin( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( IDTYPES, '", "' ), dt ) ); } if ( x.length !== mask.length ) { - throw new RangeError( format( 'invalid arguments. First and second arguments must have the same length.' ) ); + throw new RangeError( 'invalid arguments. First and second arguments must have the same length.' ); } return strided( x.length, x, 1, 0, mask, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/stats/array/mskminabs/lib/main.js b/lib/node_modules/@stdlib/stats/array/mskminabs/lib/main.js index eaa51fd4299e..42c4e3d0e5ee 100644 --- a/lib/node_modules/@stdlib/stats/array/mskminabs/lib/main.js +++ b/lib/node_modules/@stdlib/stats/array/mskminabs/lib/main.js @@ -73,7 +73,7 @@ function mskminabs( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( IDTYPES, '", "' ), dt ) ); } if ( x.length !== mask.length ) { - throw new RangeError( format( 'invalid arguments. First and second arguments must have the same length.' ) ); + throw new RangeError( 'invalid arguments. First and second arguments must have the same length.' ); } return strided( x.length, x, 1, 0, mask, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/stats/array/mskrange/lib/main.js b/lib/node_modules/@stdlib/stats/array/mskrange/lib/main.js index fb935f14b434..3b31349991d5 100644 --- a/lib/node_modules/@stdlib/stats/array/mskrange/lib/main.js +++ b/lib/node_modules/@stdlib/stats/array/mskrange/lib/main.js @@ -73,7 +73,7 @@ function mskrange( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( IDTYPES, '", "' ), dt ) ); } if ( x.length !== mask.length ) { - throw new RangeError( format( 'invalid arguments. First and second arguments must have the same length.' ) ); + throw new RangeError( 'invalid arguments. First and second arguments must have the same length.' ); } return strided( x.length, x, 1, 0, mask, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/stats/array/nanmskmax/lib/main.js b/lib/node_modules/@stdlib/stats/array/nanmskmax/lib/main.js index ff0951e37801..7a5a4ec7d108 100644 --- a/lib/node_modules/@stdlib/stats/array/nanmskmax/lib/main.js +++ b/lib/node_modules/@stdlib/stats/array/nanmskmax/lib/main.js @@ -73,7 +73,7 @@ function nanmskmax( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( IDTYPES, '", "' ), dt ) ); } if ( x.length !== mask.length ) { - throw new RangeError( format( 'invalid arguments. First and second arguments must have the same length.' ) ); + throw new RangeError( 'invalid arguments. First and second arguments must have the same length.' ); } return strided( x.length, x, 1, 0, mask, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/stats/array/nanmskmidrange/lib/main.js b/lib/node_modules/@stdlib/stats/array/nanmskmidrange/lib/main.js index 9eb596e1dc75..3fe591cf31bb 100644 --- a/lib/node_modules/@stdlib/stats/array/nanmskmidrange/lib/main.js +++ b/lib/node_modules/@stdlib/stats/array/nanmskmidrange/lib/main.js @@ -73,7 +73,7 @@ function nanmskmidrange( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( IDTYPES, '", "' ), dt ) ); } if ( x.length !== mask.length ) { - throw new RangeError( format( 'invalid arguments. First and second arguments must have the same length.' ) ); + throw new RangeError( 'invalid arguments. First and second arguments must have the same length.' ); } return strided( x.length, x, 1, 0, mask, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/stats/array/nanmskmin/lib/main.js b/lib/node_modules/@stdlib/stats/array/nanmskmin/lib/main.js index 3deea44272e4..90cb5202582b 100644 --- a/lib/node_modules/@stdlib/stats/array/nanmskmin/lib/main.js +++ b/lib/node_modules/@stdlib/stats/array/nanmskmin/lib/main.js @@ -73,7 +73,7 @@ function nanmskmin( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( IDTYPES, '", "' ), dt ) ); } if ( x.length !== mask.length ) { - throw new RangeError( format( 'invalid arguments. First and second arguments must have the same length.' ) ); + throw new RangeError( 'invalid arguments. First and second arguments must have the same length.' ); } return strided( x.length, x, 1, 0, mask, 1, 0 ); } diff --git a/lib/node_modules/@stdlib/stats/array/nanmskrange/lib/main.js b/lib/node_modules/@stdlib/stats/array/nanmskrange/lib/main.js index 1a35d90a89fc..d5996adff585 100644 --- a/lib/node_modules/@stdlib/stats/array/nanmskrange/lib/main.js +++ b/lib/node_modules/@stdlib/stats/array/nanmskrange/lib/main.js @@ -73,7 +73,7 @@ function nanmskrange( x, mask ) { throw new TypeError( format( 'invalid argument. Second argument must have one of the following data types: "%s". Data type: `%s`.', join( IDTYPES, '", "' ), dt ) ); } if ( x.length !== mask.length ) { - throw new RangeError( format( 'invalid arguments. First and second arguments must have the same length.' ) ); + throw new RangeError( 'invalid arguments. First and second arguments must have the same length.' ); } return strided( x.length, x, 1, 0, mask, 1, 0 ); }