diff --git a/lib/node_modules/@stdlib/stats/min-by/README.md b/lib/node_modules/@stdlib/stats/min-by/README.md
new file mode 100644
index 000000000000..77f65dc40239
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/README.md
@@ -0,0 +1,344 @@
+
+
+# minBy
+
+> Compute the minimum value along one or more [ndarray][@stdlib/ndarray/ctor] dimensions according to a callback function.
+
+
+
+## Usage
+
+```javascript
+var minBy = require( '@stdlib/stats/min-by' );
+```
+
+#### minBy( x\[, options], clbk\[, thisArg] )
+
+Computes the minimum value along one or more [ndarray][@stdlib/ndarray/ctor] dimensions according to a callback function.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+
+var x = array( [ -1.0, 2.0, -3.0 ] );
+
+function clbk( v ) {
+ return v * 2.0;
+}
+
+var y = minBy( x, clbk );
+// returns
+
+var v = y.get();
+// returns -6.0
+```
+
+The function has the following parameters:
+
+- **x**: input [ndarray][@stdlib/ndarray/ctor].
+- **options**: function options (_optional_).
+- **clbk**: callback function.
+- **thisArg**: callback function execution context (_optional_).
+
+The invoked callback is provided three arguments:
+
+- **value**: current array element.
+- **idx**: current array element index.
+- **array**: input ndarray.
+
+To set the callback execution context, provide a `thisArg`.
+
+
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+
+var x = array( [ -1.0, 2.0, -3.0 ] );
+
+function clbk( v ) {
+ this.count += 1;
+ return v * 2.0;
+}
+
+var ctx = {
+ 'count': 0
+};
+var y = minBy( x, clbk, ctx );
+// returns
+
+var v = y.get();
+// returns -6.0
+
+var count = ctx.count;
+// returns 3
+```
+
+The function accepts the following options:
+
+- **dims**: list of dimensions over which to perform a reduction. If not provided, the function performs a reduction over all elements in a provided input [ndarray][@stdlib/ndarray/ctor].
+- **dtype**: output ndarray [data type][@stdlib/ndarray/dtypes]. Must be a real-valued or "generic" [data type][@stdlib/ndarray/dtypes].
+- **keepdims**: boolean indicating whether the reduced dimensions should be included in the returned [ndarray][@stdlib/ndarray/ctor] as singleton dimensions. Default: `false`.
+
+By default, the function performs a reduction over all elements in a provided input [ndarray][@stdlib/ndarray/ctor]. To perform a reduction over specific dimensions, provide a `dims` option.
+
+```javascript
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var array = require( '@stdlib/ndarray/array' );
+
+function clbk( v ) {
+ return v * 100.0;
+}
+
+var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
+ 'shape': [ 2, 2 ],
+ 'order': 'row-major'
+});
+var v = ndarray2array( x );
+// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
+
+var opts = {
+ 'dims': [ 0 ]
+};
+var y = minBy( x, opts, clbk );
+// returns
+
+v = ndarray2array( y );
+// returns [ -300.0, 200.0 ]
+
+opts = {
+ 'dims': [ 1 ]
+};
+y = minBy( x, opts, clbk );
+// returns
+
+v = ndarray2array( y );
+// returns [ -100.0, -300.0 ]
+
+opts = {
+ 'dims': [ 0, 1 ]
+};
+y = minBy( x, opts, clbk );
+// returns
+
+v = y.get();
+// returns -300.0
+```
+
+By default, the function excludes reduced dimensions from the output [ndarray][@stdlib/ndarray/ctor]. To include the reduced dimensions as singleton dimensions, set the `keepdims` option to `true`.
+
+```javascript
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var array = require( '@stdlib/ndarray/array' );
+
+function clbk( v ) {
+ return v * 100.0;
+}
+
+var x = array( [ -1.0, 2.0, -3.0, 4.0 ], {
+ 'shape': [ 2, 2 ],
+ 'order': 'row-major'
+});
+
+var v = ndarray2array( x );
+// returns [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ]
+
+var opts = {
+ 'dims': [ 0 ],
+ 'keepdims': true
+};
+var y = minBy( x, opts, clbk );
+// returns
+
+v = ndarray2array( y );
+// returns [ [ -300.0, 200.0 ] ]
+
+opts = {
+ 'dims': [ 1 ],
+ 'keepdims': true
+};
+y = minBy( x, opts, clbk );
+// returns
+
+v = ndarray2array( y );
+// returns [ [ -100.0 ], [ -300.0 ] ]
+
+opts = {
+ 'dims': [ 0, 1 ],
+ 'keepdims': true
+};
+y = minBy( x, opts, clbk );
+// returns
+
+v = ndarray2array( y );
+// returns [ [ -300.0 ] ]
+```
+
+By default, the function returns an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] determined by the function's output data type [policy][@stdlib/ndarray/output-dtype-policies]. To override the default behavior, set the `dtype` option.
+
+```javascript
+var getDType = require( '@stdlib/ndarray/dtype' );
+var array = require( '@stdlib/ndarray/array' );
+
+function clbk( v ) {
+ return v * 100.0;
+}
+
+var x = array( [ -1.0, 2.0, -3.0 ], {
+ 'dtype': 'generic'
+});
+
+var opts = {
+ 'dtype': 'float64'
+};
+var y = minBy( x, opts, clbk );
+// returns
+
+var dt = getDType( y );
+// returns 'float64'
+```
+
+#### minBy.assign( x, out\[, options], clbk\[, thisArg] )
+
+Computes the minimum value along one or more [ndarray][@stdlib/ndarray/ctor] dimensions according to a callback function and assigns results to a provided output [ndarray][@stdlib/ndarray/ctor].
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+
+function clbk( v ) {
+ return v * 100.0;
+}
+
+var x = array( [ -1.0, 2.0, -3.0 ] );
+var y = zeros( [] );
+
+var out = minBy.assign( x, y, clbk );
+// returns
+
+var v = out.get();
+// returns -300.0
+
+var bool = ( out === y );
+// returns true
+```
+
+The method has the following parameters:
+
+- **x**: input [ndarray][@stdlib/ndarray/ctor].
+- **out**: output [ndarray][@stdlib/ndarray/ctor].
+- **options**: function options (_optional_).
+- **clbk**: callback function.
+- **thisArg**: callback execution context (_optional_).
+
+The method accepts the following options:
+
+- **dims**: list of dimensions over which to perform a reduction. If not provided, the function performs a reduction over all elements in a provided input [ndarray][@stdlib/ndarray/ctor].
+
+
+
+
+
+
+
+## Notes
+
+- A provided callback function should return a numeric value.
+- If a provided callback function does not return any value (or equivalently, explicitly returns `undefined`), the value is **ignored**.
+- Setting the `keepdims` option to `true` can be useful when wanting to ensure that the output [ndarray][@stdlib/ndarray/ctor] is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with ndarrays having the same shape as the input [ndarray][@stdlib/ndarray/ctor].
+- The output data type [policy][@stdlib/ndarray/output-dtype-policies] only applies to the main function and specifies that, by default, the function must return an [ndarray][@stdlib/ndarray/ctor] having a real-valued or "generic" [data type][@stdlib/ndarray/dtypes]. For the `assign` method, the output [ndarray][@stdlib/ndarray/ctor] is allowed to have any supported output [data type][@stdlib/ndarray/dtypes].
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var filledarrayBy = require( '@stdlib/array/filled-by' );
+var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var minBy = require( '@stdlib/stats/min-by' );
+
+// Define a function for generating an object having a random value:
+function random() {
+ return {
+ 'value': discreteUniform( 0, 20 )
+ };
+}
+
+// Generate an array of random objects:
+var xbuf = filledarrayBy( 25, 'generic', random );
+
+// Wrap in an ndarray:
+var x = new ndarray( 'generic', xbuf, [ 5, 5 ], [ 5, 1 ], 0, 'row-major' );
+console.log( ndarray2array( x ) );
+
+// Define an accessor function:
+function accessor( v ) {
+ return v.value * 100;
+}
+
+// Perform a reduction:
+var opts = {
+ 'dims': [ 0 ]
+};
+var y = minBy( x, opts, accessor );
+
+// Resolve the output array data type:
+var dt = getDType( y );
+console.log( dt );
+
+// Print the results:
+console.log( ndarray2array( y ) );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/ndarray/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/ctor
+
+[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/dtypes
+
+[@stdlib/ndarray/output-dtype-policies]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/output-dtype-policies
+
+[@stdlib/ndarray/base/broadcast-shapes]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base/broadcast-shapes
+
+
+
+
diff --git a/lib/node_modules/@stdlib/stats/min-by/benchmark/benchmark.assign.js b/lib/node_modules/@stdlib/stats/min-by/benchmark/benchmark.assign.js
new file mode 100644
index 000000000000..9de9cb900132
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/benchmark/benchmark.assign.js
@@ -0,0 +1,122 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var uniform = require( '@stdlib/random/array/uniform' );
+var zeros = require( '@stdlib/array/zeros' );
+var ndarray = require( '@stdlib/ndarray/base/ctor' );
+var pkg = require( './../package.json' ).name;
+var minBy = require( './../lib' );
+
+
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
+// FUNCTIONS //
+
+/**
+* Accessor function.
+*
+* @private
+* @param {number} value - input value
+* @returns {number} accessed value
+*/
+function accessor( value ) {
+ return value * 2.0;
+}
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {PositiveInteger} len - array length
+* @returns {Function} benchmark function
+*/
+function createBenchmark( len ) {
+ var out;
+ var x;
+
+ x = uniform( len, -50.0, 50.0, options );
+ x = new ndarray( options.dtype, x, [ len ], [ 1 ], 0, 'row-major' );
+
+ out = new ndarray( options.dtype, zeros( 1, options.dtype ), [], [ 0 ], 0, 'row-major' );
+
+ return benchmark;
+
+ /**
+ * Benchmark function.
+ *
+ * @private
+ * @param {Benchmark} b - benchmark instance
+ */
+ function benchmark( b ) {
+ var o;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ o = minBy.assign( x, out, accessor );
+ if ( typeof o !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( isnan( o.get() ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+/**
+* Main execution sequence.
+*
+* @private
+*/
+function main() {
+ var len;
+ var min;
+ var max;
+ var f;
+ var i;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( i = min; i <= max; i++ ) {
+ len = pow( 10, i );
+ f = createBenchmark( len );
+ bench( pkg+':assign:dtype='+options.dtype+',len='+len, f );
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/stats/min-by/benchmark/benchmark.js b/lib/node_modules/@stdlib/stats/min-by/benchmark/benchmark.js
new file mode 100644
index 000000000000..1fadd4ce027b
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/benchmark/benchmark.js
@@ -0,0 +1,116 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench' );
+var isnan = require( '@stdlib/math/base/assert/is-nan' );
+var pow = require( '@stdlib/math/base/special/pow' );
+var uniform = require( '@stdlib/random/array/uniform' );
+var ndarray = require( '@stdlib/ndarray/base/ctor' );
+var pkg = require( './../package.json' ).name;
+var minBy = require( './../lib' );
+
+
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
+// FUNCTIONS //
+
+/**
+* Accessor function.
+*
+* @private
+* @param {number} value - input value
+* @returns {number} accessed value
+*/
+function accessor( value ) {
+ return value * 2.0;
+}
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {PositiveInteger} len - array length
+* @returns {Function} benchmark function
+*/
+function createBenchmark( len ) {
+ var x = uniform( len, -50.0, 50.0, options );
+ x = new ndarray( options.dtype, x, [ len ], [ 1 ], 0, 'row-major' );
+
+ return benchmark;
+
+ /**
+ * Benchmark function.
+ *
+ * @private
+ * @param {Benchmark} b - benchmark instance
+ */
+ function benchmark( b ) {
+ var o;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ o = minBy( x, accessor );
+ if ( typeof o !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( isnan( o.get() ) ) {
+ b.fail( 'should not return NaN' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+/**
+* Main execution sequence.
+*
+* @private
+*/
+function main() {
+ var len;
+ var min;
+ var max;
+ var f;
+ var i;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( i = min; i <= max; i++ ) {
+ len = pow( 10, i );
+ f = createBenchmark( len );
+ bench( pkg+':dtype='+options.dtype+',len='+len, f );
+ }
+}
+
+main();
diff --git a/lib/node_modules/@stdlib/stats/min-by/docs/repl.txt b/lib/node_modules/@stdlib/stats/min-by/docs/repl.txt
new file mode 100644
index 000000000000..cb1a8877bde5
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/docs/repl.txt
@@ -0,0 +1,113 @@
+
+{{alias}}( x[, options], clbk[, thisArg] )
+ Computes the minimum value along one or more ndarray dimensions according to
+ a callback function.
+
+ The callback function is provided three arguments:
+
+ - value: current array element.
+ - index: current array index.
+ - array: the input ndarray.
+
+ The callback function should return a numeric value.
+
+ If the callback function does not return any value (or equivalently,
+ explicitly returns `undefined`), the value is ignored.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array.
+
+ options: Object (optional)
+ Function options.
+
+ options.dtype: string (optional)
+ Output array data type. Must be a real-valued or "generic" data type.
+
+ options.dims: Array (optional)
+ List of dimensions over which to perform a reduction. If not provided,
+ the function performs a reduction over all elements in a provided input
+ ndarray.
+
+ options.keepdims: boolean (optional)
+ Boolean indicating whether the reduced dimensions should be included in
+ the returned ndarray as singleton dimensions. Default: false.
+
+ clbk: Function
+ Callback function.
+
+ thisArg: any (optional)
+ Callback function execution context.
+
+ Returns
+ -------
+ out: ndarray
+ Output array.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] );
+ > function clbk( v ) { return v * 2.0; };
+ > var y = {{alias}}( x, clbk );
+ > var v = y.get()
+ -8.0
+
+
+{{alias}}.assign( x, out[, options], clbk[, thisArg] )
+ Computes the minimum value along one or more ndarray dimensions according to
+ a callback function and assigns results to a provided output ndarray.
+
+ The callback function is provided three arguments:
+
+ - value: current array element.
+ - index: current array index.
+ - array: the input ndarray.
+
+ The callback function should return a numeric value.
+
+ If the callback function does not return any value (or equivalently,
+ explicitly returns `undefined`), the value is ignored.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array.
+
+ out: ndarray
+ Output array.
+
+ options: Object (optional)
+ Function options.
+
+ options.dims: Array (optional)
+ List of dimensions over which to perform a reduction. If not provided,
+ the function performs a reduction over all elements in a provided input
+ ndarray.
+
+ clbk: Function
+ Callback function.
+
+ thisArg: any (optional)
+ Callback function execution context.
+
+ Returns
+ -------
+ out: ndarray
+ Output array.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] );
+ > var out = {{alias:@stdlib/ndarray/zeros}}( [] );
+ > function clbk( v ) { return v * 2.0; };
+ > var y = {{alias}}.assign( x, out, clbk )
+
+ > var bool = ( out === y )
+ true
+ > var v = out.get()
+ -8.0
+
+ See Also
+ --------
+
diff --git a/lib/node_modules/@stdlib/stats/min-by/docs/types/index.d.ts b/lib/node_modules/@stdlib/stats/min-by/docs/types/index.d.ts
new file mode 100644
index 000000000000..edde0d39bf65
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/docs/types/index.d.ts
@@ -0,0 +1,273 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+// TypeScript Version: 4.1
+
+///
+
+import { ArrayLike } from '@stdlib/types/array';
+import { RealAndGenericDataType as DataType, typedndarray } from '@stdlib/types/ndarray';
+
+/**
+* Input array.
+*/
+type InputArray = typedndarray;
+
+/**
+* Output array.
+*/
+type OutputArray = typedndarray;
+
+/**
+* Returns the result of callback function.
+*
+* @returns result
+*/
+type NullaryCallback = ( this: ThisArg ) => number | void;
+
+/**
+* Returns the result of callback function.
+*
+* @param value - current array element
+* @returns result
+*/
+type UnaryCallback = ( this: ThisArg, value: T ) => number | void;
+
+/**
+* Returns the result of callback function.
+*
+* @param value - current array element
+* @param index - current array element index
+* @returns result
+*/
+type BinaryCallback = ( this: ThisArg, value: T, index: number ) => number | void;
+
+/**
+* Returns the result of callback function.
+*
+* @param value - current array element
+* @param index - current array element index
+* @param array - input ndarray
+* @returns result
+*/
+type TernaryCallback = ( this: ThisArg, value: T, index: number, array: U ) => number | void;
+
+/**
+* Returns the result of callback function.
+*
+* @param value - current array element
+* @param index - current array element index
+* @param array - input ndarray
+* @returns result
+*/
+type Callback = NullaryCallback | UnaryCallback | BinaryCallback | TernaryCallback;
+
+/**
+* Interface defining "base" options.
+*/
+interface BaseOptions {
+ /**
+ * List of dimensions over which to perform a reduction.
+ */
+ dims?: ArrayLike;
+}
+
+/**
+* Interface defining options.
+*/
+interface Options extends BaseOptions {
+ /**
+ * Output array data type.
+ */
+ dtype?: DataType;
+
+ /**
+ * Boolean indicating whether the reduced dimensions should be included in the returned array as singleton dimensions. Default: `false`.
+ */
+ keepdims?: boolean;
+}
+
+/**
+* Interface for performing a reduction on an ndarray according to a callback function.
+*/
+interface Unary {
+ /**
+ * Computes the minimum value along one or more ndarray dimensions according to a callback function.
+ *
+ * @param x - input ndarray
+ * @param clbk - callback function
+ * @param thisArg - callback function execution context
+ * @returns output ndarray
+ *
+ * @example
+ * var array = require( '@stdlib/ndarray/array' );
+ *
+ * function clbk( value ) {
+ * return value * 2.0;
+ * }
+ *
+ * var x = array( [ -1.0, 2.0, -3.0 ] );
+ *
+ * var y = minBy( x, clbk );
+ * // returns
+ *
+ * var v = y.get();
+ * // returns -6.0
+ */
+ = InputArray, ThisArg = unknown>( x: U, clbk: Callback, thisArg?: ThisParameterType> ): OutputArray; // NOTE: we lose type specificity here, but retaining specificity would likely be difficult and/or tedious to completely enumerate, as the output ndarray data type is dependent on how `x` interacts with output data type policy and whether that policy has been overridden by `options.dtype`.
+
+ /**
+ * Computes the minimum value along one or more ndarray dimensions according to a callback function.
+ *
+ * @param x - input ndarray
+ * @param options - function options
+ * @param clbk - callback function
+ * @param thisArg - callback function execution context
+ * @returns output ndarray
+ *
+ * @example
+ * var array = require( '@stdlib/ndarray/array' );
+ *
+ * function clbk( value ) {
+ * return value * 2.0;
+ * }
+ *
+ * var x = array( [ -1.0, 2.0, -3.0 ] );
+ *
+ * var y = minBy( x, {}, clbk );
+ * // returns
+ *
+ * var v = y.get();
+ * // returns -6.0
+ */
+ = InputArray, ThisArg = unknown>( x: U, options: Options, clbk: Callback, thisArg?: ThisParameterType> ): OutputArray; // NOTE: we lose type specificity here, but retaining specificity would likely be difficult and/or tedious to completely enumerate, as the output ndarray data type is dependent on how `x` interacts with output data type policy and whether that policy has been overridden by `options.dtype`.
+
+ /**
+ * Computes the minimum value along one or more ndarray dimensions according to a callback function and assigns results to a provided output ndarray.
+ *
+ * @param x - input ndarray
+ * @param out - output ndarray
+ * @param clbk - callback function
+ * @param thisArg - callback function execution context
+ * @returns output ndarray
+ *
+ * @example
+ * var array = require( '@stdlib/ndarray/array' );
+ * var zeros = require( '@stdlib/ndarray/zeros' );
+ *
+ * var x = array( [ -1.0, 2.0, -3.0 ] );
+ * var y = zeros( [] );
+ *
+ * function clbk( value ) {
+ * return value * 2.0;
+ * }
+ *
+ * var out = minBy.assign( x, y, clbk );
+ * // returns
+ *
+ * var v = out.get();
+ * // returns -6.0
+ *
+ * var bool = ( out === y );
+ * // returns true
+ */
+ assign = InputArray, V extends OutputArray = OutputArray, ThisArg = unknown>( x: U, out: V, clbk: Callback, thisArg?: ThisParameterType> ): V;
+
+ /**
+ * Computes the minimum value along one or more ndarray dimensions according to a callback function and assigns results to a provided output ndarray.
+ *
+ * @param x - input ndarray
+ * @param out - output ndarray
+ * @param options - function options
+ * @param clbk - callback function
+ * @param thisArg - callback function execution context
+ * @returns output ndarray
+ *
+ * @example
+ * var array = require( '@stdlib/ndarray/array' );
+ * var zeros = require( '@stdlib/ndarray/zeros' );
+ *
+ * var x = array( [ -1.0, 2.0, -3.0 ] );
+ * var y = zeros( [] );
+ *
+ * function clbk( value ) {
+ * return value * 2.0;
+ * }
+ *
+ * var out = minBy.assign( x, y, {}, clbk );
+ * // returns
+ *
+ * var v = out.get();
+ * // returns -6.0
+ *
+ * var bool = ( out === y );
+ * // returns true
+ */
+ assign = InputArray, V extends OutputArray = OutputArray, ThisArg = unknown>( x: U, out: V, options: BaseOptions, clbk: Callback, thisArg?: ThisParameterType> ): V;
+}
+
+/**
+* Computes the minimum value along one or more ndarray dimensions according to a callback function.
+*
+* @param x - input ndarray
+* @param options - function options
+* @param clbk - callback function
+* @param thisArg - callback execution context
+* @returns output ndarray
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ -1.0, 2.0, -3.0 ] )
+*
+* function clbk( value ) {
+* return value * 2.0;
+* }
+*
+* var y = minBy( x, clbk );
+* // returns
+*
+* var v = y.get();
+* // returns -6.0
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+* var zeros = require( '@stdlib/ndarray/zeros' );
+*
+* var x = array( [ -1.0, 2.0, -3.0 ] )
+* var y = zeros( [] );
+*
+* function clbk( value ) {
+* return value * 2.0;
+* }
+*
+* var out = minBy.assign( x, y, clbk );
+* // returns
+*
+* var v = out.get();
+* // returns -6.0
+*
+* var bool = ( out === y );
+* // returns true
+*/
+declare const minBy: Unary;
+
+
+// EXPORTS //
+
+export = minBy;
diff --git a/lib/node_modules/@stdlib/stats/min-by/docs/types/test.ts b/lib/node_modules/@stdlib/stats/min-by/docs/types/test.ts
new file mode 100644
index 000000000000..4fdafada547c
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/docs/types/test.ts
@@ -0,0 +1,393 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+/* eslint-disable @typescript-eslint/no-unused-expressions, space-in-parens */
+
+///
+
+import zeros = require( '@stdlib/ndarray/zeros' );
+import minBy = require( './index' );
+
+/**
+* Callback function.
+*
+* @param value - ndarray element
+* @returns result
+*/
+function clbk( value: number ): number {
+ return value * 2.0;
+}
+
+
+// TESTS //
+
+// The function returns an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy( x, clbk ); // $ExpectType OutputArray
+ minBy( x, clbk, {} ); // $ExpectType OutputArray
+
+ minBy( x, {}, clbk ); // $ExpectType OutputArray
+ minBy( x, {}, clbk, {} ); // $ExpectType OutputArray
+}
+
+// The compiler throws an error if the function is provided a first argument which is not an ndarray...
+{
+ minBy( '5', clbk ); // $ExpectError
+ minBy( 5, clbk ); // $ExpectError
+ minBy( true, clbk ); // $ExpectError
+ minBy( false, clbk ); // $ExpectError
+ minBy( null, clbk ); // $ExpectError
+ minBy( void 0, clbk ); // $ExpectError
+ minBy( {}, clbk ); // $ExpectError
+ minBy( ( x: number ): number => x, clbk ); // $ExpectError
+
+ minBy( '5', clbk, {} ); // $ExpectError
+ minBy( 5, clbk, {} ); // $ExpectError
+ minBy( true, clbk, {} ); // $ExpectError
+ minBy( false, clbk, {} ); // $ExpectError
+ minBy( null, clbk, {} ); // $ExpectError
+ minBy( void 0, clbk, {} ); // $ExpectError
+ minBy( {}, clbk, {} ); // $ExpectError
+ minBy( ( x: number ): number => x, clbk, {} ); // $ExpectError
+
+ minBy( '5', {}, clbk ); // $ExpectError
+ minBy( 5, {}, clbk ); // $ExpectError
+ minBy( true, {}, clbk ); // $ExpectError
+ minBy( false, {}, clbk ); // $ExpectError
+ minBy( null, {}, clbk ); // $ExpectError
+ minBy( void 0, {}, clbk ); // $ExpectError
+ minBy( {}, {}, clbk ); // $ExpectError
+ minBy( ( x: number ): number => x, {}, clbk ); // $ExpectError
+
+ minBy( '5', {}, clbk, {} ); // $ExpectError
+ minBy( 5, {}, clbk, {} ); // $ExpectError
+ minBy( true, {}, clbk, {} ); // $ExpectError
+ minBy( false, {}, clbk, {} ); // $ExpectError
+ minBy( null, {}, clbk, {} ); // $ExpectError
+ minBy( void 0, {}, clbk, {} ); // $ExpectError
+ minBy( {}, {}, clbk, {} ); // $ExpectError
+ minBy( ( x: number ): number => x, {}, clbk, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an options argument which is not an object...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy( x, '5', clbk ); // $ExpectError
+ minBy( x, true, clbk ); // $ExpectError
+ minBy( x, false, clbk ); // $ExpectError
+ minBy( x, null, clbk ); // $ExpectError
+ minBy( x, [], clbk ); // $ExpectError
+
+ minBy( x, '5', clbk, {} ); // $ExpectError
+ minBy( x, true, clbk, {} ); // $ExpectError
+ minBy( x, false, clbk, {} ); // $ExpectError
+ minBy( x, null, clbk, {} ); // $ExpectError
+ minBy( x, [], clbk, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a callback argument which is not a function...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy( x, '5' ); // $ExpectError
+ minBy( x, true ); // $ExpectError
+ minBy( x, false ); // $ExpectError
+ minBy( x, null ); // $ExpectError
+ minBy( x, [] ); // $ExpectError
+
+ minBy( x, '5', {} ); // $ExpectError
+ minBy( x, true, {} ); // $ExpectError
+ minBy( x, false, {} ); // $ExpectError
+ minBy( x, null, {} ); // $ExpectError
+ minBy( x, [], {} ); // $ExpectError
+
+ minBy( x, {}, '5', {} ); // $ExpectError
+ minBy( x, {}, true, {} ); // $ExpectError
+ minBy( x, {}, false, {} ); // $ExpectError
+ minBy( x, {}, null, {} ); // $ExpectError
+ minBy( x, {}, [], {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid `dtype` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy( x, { 'dtype': '5' }, clbk ); // $ExpectError
+ minBy( x, { 'dtype': 5 }, clbk ); // $ExpectError
+ minBy( x, { 'dtype': true }, clbk ); // $ExpectError
+ minBy( x, { 'dtype': false }, clbk ); // $ExpectError
+ minBy( x, { 'dtype': null }, clbk ); // $ExpectError
+ minBy( x, { 'dtype': [] }, clbk ); // $ExpectError
+ minBy( x, { 'dtype': {} }, clbk ); // $ExpectError
+ minBy( x, { 'dtype': ( x: number ): number => x }, clbk ); // $ExpectError
+
+ minBy( x, { 'dtype': '5' }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dtype': 5 }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dtype': true }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dtype': false }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dtype': null }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dtype': [] }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dtype': {} }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dtype': ( x: number ): number => x }, clbk, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid `keepdims` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy( x, { 'keepdims': '5' }, clbk ); // $ExpectError
+ minBy( x, { 'keepdims': 5 }, clbk ); // $ExpectError
+ minBy( x, { 'keepdims': null }, clbk ); // $ExpectError
+ minBy( x, { 'keepdims': [] }, clbk ); // $ExpectError
+ minBy( x, { 'keepdims': {} }, clbk ); // $ExpectError
+ minBy( x, { 'keepdims': ( x: number ): number => x }, clbk ); // $ExpectError
+
+ minBy( x, { 'keepdims': '5' }, clbk, {} ); // $ExpectError
+ minBy( x, { 'keepdims': 5 }, clbk, {} ); // $ExpectError
+ minBy( x, { 'keepdims': null }, clbk, {} ); // $ExpectError
+ minBy( x, { 'keepdims': [] }, clbk, {} ); // $ExpectError
+ minBy( x, { 'keepdims': {} }, clbk, {} ); // $ExpectError
+ minBy( x, { 'keepdims': ( x: number ): number => x }, clbk, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid `dims` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy( x, { 'dims': '5' }, clbk ); // $ExpectError
+ minBy( x, { 'dims': 5 }, clbk ); // $ExpectError
+ minBy( x, { 'dims': true }, clbk ); // $ExpectError
+ minBy( x, { 'dims': false }, clbk ); // $ExpectError
+ minBy( x, { 'dims': null }, clbk ); // $ExpectError
+ minBy( x, { 'dims': {} }, clbk ); // $ExpectError
+ minBy( x, { 'dims': ( x: number ): number => x }, clbk ); // $ExpectError
+
+ minBy( x, { 'dims': '5' }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dims': 5 }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dims': true }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dims': false }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dims': null }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dims': {} }, clbk, {} ); // $ExpectError
+ minBy( x, { 'dims': ( x: number ): number => x }, clbk, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy(); // $ExpectError
+ minBy( x );
+ minBy( x, {}, clbk, {}, {} ); // $ExpectError
+}
+
+// Attached to the function is an `assign` method which returns an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy.assign( x, x, clbk ); // $ExpectType float64ndarray
+ minBy.assign( x, x, {}, clbk ); // $ExpectType float64ndarray
+
+ minBy.assign( x, x, clbk, {} ); // $ExpectType float64ndarray
+ minBy.assign( x, x, {}, clbk, {} ); // $ExpectType float64ndarray
+}
+
+// The compiler throws an error if the `assign` method is provided a first argument which is not an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy.assign( '5', x, clbk ); // $ExpectError
+ minBy.assign( 5, x, clbk ); // $ExpectError
+ minBy.assign( true, x, clbk ); // $ExpectError
+ minBy.assign( false, x, clbk ); // $ExpectError
+ minBy.assign( null, x, clbk ); // $ExpectError
+ minBy.assign( void 0, x, clbk ); // $ExpectError
+ minBy.assign( {}, x, clbk ); // $ExpectError
+ minBy.assign( ( x: number ): number => x, x, clbk ); // $ExpectError
+
+ minBy.assign( '5', x, {}, clbk ); // $ExpectError
+ minBy.assign( 5, x, {}, clbk ); // $ExpectError
+ minBy.assign( true, x, {}, clbk ); // $ExpectError
+ minBy.assign( false, x, {}, clbk ); // $ExpectError
+ minBy.assign( null, x, {}, clbk ); // $ExpectError
+ minBy.assign( void 0, x, {}, clbk ); // $ExpectError
+ minBy.assign( {}, x, {}, clbk ); // $ExpectError
+ minBy.assign( ( x: number ): number => x, x, {}, clbk ); // $ExpectError
+
+ minBy.assign( '5', x, clbk, {} ); // $ExpectError
+ minBy.assign( 5, x, clbk, {} ); // $ExpectError
+ minBy.assign( true, x, clbk, {} ); // $ExpectError
+ minBy.assign( false, x, clbk, {} ); // $ExpectError
+ minBy.assign( null, x, clbk, {} ); // $ExpectError
+ minBy.assign( void 0, x, clbk, {} ); // $ExpectError
+ minBy.assign( {}, x, clbk, {} ); // $ExpectError
+ minBy.assign( ( x: number ): number => x, x, clbk, {} ); // $ExpectError
+
+ minBy.assign( '5', x, {}, clbk, {} ); // $ExpectError
+ minBy.assign( 5, x, {}, clbk, {} ); // $ExpectError
+ minBy.assign( true, x, {}, clbk, {} ); // $ExpectError
+ minBy.assign( false, x, {}, clbk, {} ); // $ExpectError
+ minBy.assign( null, x, {}, clbk, {} ); // $ExpectError
+ minBy.assign( void 0, x, {}, clbk, {} ); // $ExpectError
+ minBy.assign( {}, x, {}, clbk, {} ); // $ExpectError
+ minBy.assign( ( x: number ): number => x, x, {}, clbk, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided a second argument which is not an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy.assign( x, '5', clbk ); // $ExpectError
+ minBy.assign( x, 5, clbk ); // $ExpectError
+ minBy.assign( x, true, clbk ); // $ExpectError
+ minBy.assign( x, false, clbk ); // $ExpectError
+ minBy.assign( x, null, clbk ); // $ExpectError
+ minBy.assign( x, void 0, clbk ); // $ExpectError
+ minBy.assign( x, ( x: number ): number => x, clbk ); // $ExpectError
+
+ minBy.assign( x, '5', {}, clbk ); // $ExpectError
+ minBy.assign( x, 5, {}, clbk ); // $ExpectError
+ minBy.assign( x, true, {}, clbk ); // $ExpectError
+ minBy.assign( x, false, {}, clbk ); // $ExpectError
+ minBy.assign( x, null, {}, clbk ); // $ExpectError
+ minBy.assign( x, void 0, {}, clbk ); // $ExpectError
+ minBy.assign( x, ( x: number ): number => x, {}, clbk ); // $ExpectError
+
+ minBy.assign( x, '5', clbk, {} ); // $ExpectError
+ minBy.assign( x, 5, clbk, {} ); // $ExpectError
+ minBy.assign( x, true, clbk, {} ); // $ExpectError
+ minBy.assign( x, false, clbk, {} ); // $ExpectError
+ minBy.assign( x, null, clbk, {} ); // $ExpectError
+ minBy.assign( x, void 0, clbk, {} ); // $ExpectError
+ minBy.assign( x, ( x: number ): number => x, clbk, {} ); // $ExpectError
+
+ minBy.assign( x, '5', {}, clbk, {} ); // $ExpectError
+ minBy.assign( x, 5, {}, clbk, {} ); // $ExpectError
+ minBy.assign( x, true, {}, clbk, {} ); // $ExpectError
+ minBy.assign( x, false, {}, clbk, {} ); // $ExpectError
+ minBy.assign( x, null, {}, clbk, {} ); // $ExpectError
+ minBy.assign( x, void 0, {}, clbk, {} ); // $ExpectError
+ minBy.assign( x, ( x: number ): number => x, {}, clbk, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided an options argument which is not an object...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy.assign( x, x, '5', clbk ); // $ExpectError
+ minBy.assign( x, x, true, clbk ); // $ExpectError
+ minBy.assign( x, x, false, clbk ); // $ExpectError
+ minBy.assign( x, x, null, clbk ); // $ExpectError
+ minBy.assign( x, x, [], clbk ); // $ExpectError
+
+ minBy.assign( x, x, '5', clbk, {} ); // $ExpectError
+ minBy.assign( x, x, true, clbk, {} ); // $ExpectError
+ minBy.assign( x, x, false, clbk, {} ); // $ExpectError
+ minBy.assign( x, x, null, clbk, {} ); // $ExpectError
+ minBy.assign( x, x, [], clbk, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided a callback argument which is not a function...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy.assign( x, x, '5' ); // $ExpectError
+ minBy.assign( x, x, true ); // $ExpectError
+ minBy.assign( x, x, false ); // $ExpectError
+ minBy.assign( x, x, null ); // $ExpectError
+ minBy.assign( x, x, [] ); // $ExpectError
+
+ minBy.assign( x, x, '5', {} ); // $ExpectError
+ minBy.assign( x, x, true, {} ); // $ExpectError
+ minBy.assign( x, x, false, {} ); // $ExpectError
+ minBy.assign( x, x, null, {} ); // $ExpectError
+ minBy.assign( x, x, [], {} ); // $ExpectError
+
+ minBy.assign( x, x, {}, '5' ); // $ExpectError
+ minBy.assign( x, x, {}, true ); // $ExpectError
+ minBy.assign( x, x, {}, false ); // $ExpectError
+ minBy.assign( x, x, {}, null ); // $ExpectError
+ minBy.assign( x, x, {}, [] ); // $ExpectError
+
+ minBy.assign( x, x, {}, '5', {} ); // $ExpectError
+ minBy.assign( x, x, {}, true, {} ); // $ExpectError
+ minBy.assign( x, x, {}, false, {} ); // $ExpectError
+ minBy.assign( x, x, {}, null, {} ); // $ExpectError
+ minBy.assign( x, x, {}, [], {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided an invalid `dims` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy.assign( x, x, { 'dims': '5' }, clbk ); // $ExpectError
+ minBy.assign( x, x, { 'dims': 5 }, clbk ); // $ExpectError
+ minBy.assign( x, x, { 'dims': true }, clbk ); // $ExpectError
+ minBy.assign( x, x, { 'dims': false }, clbk ); // $ExpectError
+ minBy.assign( x, x, { 'dims': null }, clbk ); // $ExpectError
+ minBy.assign( x, x, { 'dims': {} }, clbk ); // $ExpectError
+ minBy.assign( x, x, { 'dims': ( x: number ): number => x }, clbk ); // $ExpectError
+
+ minBy.assign( x, x, { 'dims': '5' }, clbk, {} ); // $ExpectError
+ minBy.assign( x, x, { 'dims': 5 }, clbk, {} ); // $ExpectError
+ minBy.assign( x, x, { 'dims': true }, clbk, {} ); // $ExpectError
+ minBy.assign( x, x, { 'dims': false }, clbk, {} ); // $ExpectError
+ minBy.assign( x, x, { 'dims': null }, clbk, {} ); // $ExpectError
+ minBy.assign( x, x, { 'dims': {} }, clbk, {} ); // $ExpectError
+ minBy.assign( x, x, { 'dims': ( x: number ): number => x }, clbk, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided an unsupported number of arguments...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ minBy.assign(); // $ExpectError
+ minBy.assign( x ); // $ExpectError
+ minBy.assign( x, x ); // $ExpectError
+ minBy.assign( x, x, {}, clbk, {}, {} ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/stats/min-by/examples/index.js b/lib/node_modules/@stdlib/stats/min-by/examples/index.js
new file mode 100644
index 000000000000..023363511516
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/examples/index.js
@@ -0,0 +1,58 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+var filledarrayBy = require( '@stdlib/array/filled-by' );
+var discreteUniform = require( '@stdlib/random/base/discrete-uniform' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var minBy = require( './../lib' );
+
+// Define a function for generating an object having a random value:
+function random() {
+ return {
+ 'value': discreteUniform( 0, 20 )
+ };
+}
+
+// Generate an array of random objects:
+var xbuf = filledarrayBy( 25, 'generic', random );
+
+// Wrap in an ndarray:
+var x = new ndarray( 'generic', xbuf, [ 5, 5 ], [ 5, 1 ], 0, 'row-major' );
+console.log( ndarray2array( x ) );
+
+// Define an accessor function:
+function accessor( v ) {
+ return v.value * 100;
+}
+
+// Perform a reduction:
+var opts = {
+ 'dims': [ 0 ]
+};
+var y = minBy( x, opts, accessor );
+
+// Resolve the output array data type:
+var dt = getDType( y );
+console.log( dt );
+
+// Print the results:
+console.log( ndarray2array( y ) );
diff --git a/lib/node_modules/@stdlib/stats/min-by/lib/index.js b/lib/node_modules/@stdlib/stats/min-by/lib/index.js
new file mode 100644
index 000000000000..da8a2e13b593
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/lib/index.js
@@ -0,0 +1,68 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+/**
+* Compute the minimum value along one or more ndarray dimensions according to a callback function.
+*
+* @module @stdlib/stats/min-by
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+* var minBy = require( '@stdlib/stats/min-by' );
+*
+* // Create a data buffer:
+* var xbuf = new Float64Array( [ 0.0, 2.0, 3.0, 0.0, 0.0, 6.0, 7.0, 0.0, 0.0, 10.0, 11.0, 0.0 ] );
+*
+* // Define the shape of the input array:
+* var sh = [ 3, 1, 2 ];
+*
+* // Define the array strides:
+* var sx = [ 4, 4, 1 ];
+*
+* // Define the index offset:
+* var ox = 1;
+*
+* // Create an input ndarray:
+* var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
+*
+* // Define an accessor function:
+* function clbk( value ) {
+* return value * 2.0;
+* }
+*
+* // Perform reduction:
+* var out = minBy( x, clbk );
+* // returns
+*
+* var v = out.get();
+* // returns 4.0
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
+
+// exports: { "assign": "main.assign" }
diff --git a/lib/node_modules/@stdlib/stats/min-by/lib/main.js b/lib/node_modules/@stdlib/stats/min-by/lib/main.js
new file mode 100644
index 000000000000..0bcbcd2b4b7e
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/lib/main.js
@@ -0,0 +1,99 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var dtypes = require( '@stdlib/ndarray/dtypes' );
+var gminBy = require( '@stdlib/stats/base/ndarray/min-by' );
+var factory = require( '@stdlib/ndarray/base/unary-reduce-strided1d-dispatch-by-factory' );
+
+
+// VARIABLES //
+
+var idtypes = dtypes(); // note: we allow any supported data type, as, in principle, a callback can transform any accessed element into a value having a desired data type
+var odtypes = dtypes( 'real_and_generic' );
+var policies = {
+ 'output': 'real_and_generic',
+ 'casting': 'none'
+};
+var table = {
+ 'default': gminBy
+};
+
+
+// MAIN //
+
+/**
+* Computes the minimum value along one or more ndarray dimensions according to a callback function.
+*
+* @name minBy
+* @type {Function}
+* @param {ndarray} x - input ndarray
+* @param {Options} [options] - function options
+* @param {IntegerArray} [options.dims] - list of dimensions over which to perform a reduction
+* @param {boolean} [options.keepdims=false] - boolean indicating whether the reduced dimensions should be included in the returned ndarray as singleton dimensions
+* @param {string} [options.dtype] - output ndarray data type
+* @param {Function} clbk - callback function
+* @param {*} [thisArg] - callback function execution context
+* @throws {TypeError} first argument must be an ndarray-like object
+* @throws {TypeError} options argument must be an object
+* @throws {TypeError} callback argument must be a function
+* @throws {RangeError} dimension indices must not exceed input ndarray bounds
+* @throws {RangeError} number of dimension indices must not exceed the number of input ndarray dimensions
+* @throws {Error} must provide valid options
+* @returns {ndarray} output ndarray
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+*
+* // Create a data buffer:
+* var xbuf = new Float64Array( [ 0.0, 2.0, 3.0, 0.0, 0.0, 6.0, 7.0, 0.0, 0.0, 10.0, 11.0, 0.0 ] );
+*
+* // Define the shape of the input array:
+* var sh = [ 3, 1, 2 ];
+*
+* // Define the array strides:
+* var sx = [ 4, 4, 1 ];
+*
+* // Define the index offset:
+* var ox = 1;
+*
+* // Create an input ndarray:
+* var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
+*
+* // Define an accessor function:
+* function clbk( value ) {
+* return value * 2.0;
+* }
+*
+* // Perform reduction:
+* var out = minBy( x, clbk );
+* // returns
+*
+* var v = out.get();
+* // returns 4.0
+*/
+var minBy = factory( table, [ idtypes ], odtypes, policies );
+
+
+// EXPORTS //
+
+module.exports = minBy;
diff --git a/lib/node_modules/@stdlib/stats/min-by/package.json b/lib/node_modules/@stdlib/stats/min-by/package.json
new file mode 100644
index 000000000000..73a7ef93f599
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "@stdlib/stats/min-by",
+ "version": "0.0.0",
+ "description": "Compute the minimum value along one or more ndarray dimensions according to a callback function.",
+ "license": "Apache-2.0",
+ "author": {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ },
+ "contributors": [
+ {
+ "name": "The Stdlib Authors",
+ "url": "https://github.com/stdlib-js/stdlib/graphs/contributors"
+ }
+ ],
+ "main": "./lib",
+ "directories": {
+ "benchmark": "./benchmark",
+ "doc": "./docs",
+ "example": "./examples",
+ "lib": "./lib",
+ "test": "./test"
+ },
+ "types": "./docs/types",
+ "scripts": {},
+ "homepage": "https://github.com/stdlib-js/stdlib",
+ "repository": {
+ "type": "git",
+ "url": "git://github.com/stdlib-js/stdlib.git"
+ },
+ "bugs": {
+ "url": "https://github.com/stdlib-js/stdlib/issues"
+ },
+ "dependencies": {},
+ "devDependencies": {},
+ "engines": {
+ "node": ">=0.10.0",
+ "npm": ">2.7.0"
+ },
+ "os": [
+ "aix",
+ "darwin",
+ "freebsd",
+ "linux",
+ "macos",
+ "openbsd",
+ "sunos",
+ "win32",
+ "windows"
+ ],
+ "keywords": [
+ "stdlib",
+ "stdmath",
+ "statistics",
+ "stats",
+ "mathematics",
+ "math",
+ "minimum",
+ "min",
+ "range",
+ "extremes",
+ "domain",
+ "extent",
+ "ndarray"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/stats/min-by/test/test.assign.js b/lib/node_modules/@stdlib/stats/min-by/test/test.assign.js
new file mode 100644
index 000000000000..9171eca11952
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/test/test.assign.js
@@ -0,0 +1,1150 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+var emptyLike = require( '@stdlib/ndarray/empty-like' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var minBy = require( './../lib' ).assign;
+
+
+// FUNCTIONS //
+
+/**
+* Callback function.
+*
+* @private
+* @param {number} value - input value
+* @returns {number} accessed value
+*/
+function clbk( value ) {
+ return value * 10.0;
+}
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof minBy, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object', function test( t ) {
+ var values;
+ var out;
+ var i;
+
+ out = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( value, out, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (thisArg)', function test( t ) {
+ var values;
+ var out;
+ var i;
+
+ out = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( value, out, clbk, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (options)', function test( t ) {
+ var values;
+ var out;
+ var i;
+
+ out = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( value, out, {}, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (options, thisArg)', function test( t ) {
+ var values;
+ var out;
+ var i;
+
+ out = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( value, out, {}, clbk, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument which is not an ndarray-like object', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, value, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument which is not an ndarray-like object (thisArg)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, value, clbk, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument which is not an ndarray-like object (options)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, value, {}, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument which is not an ndarray-like object (options, thisArg)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, value, {}, clbk, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) {
+ var values;
+ var out;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+ out = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ []
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, out, value, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (thisArg)', function test( t ) {
+ var values;
+ var out;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+ out = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ []
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, out, value, clbk, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a callback argument which is not a function', function test( t ) {
+ var values;
+ var out;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+ out = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, out, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a callback argument which is not a function (thisArg)', function test( t ) {
+ var values;
+ var out;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+ out = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, out, value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a callback argument which is not a function (options)', function test( t ) {
+ var values;
+ var out;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+ out = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, out, {}, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a callback argument which is not a function (options, thisArg)', function test( t ) {
+ var values;
+ var out;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+ out = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, out, {}, value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which is not an array-like object of integers', function test( t ) {
+ var values;
+ var out;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+ out = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [ 'a' ],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts = {
+ 'dims': value
+ };
+ minBy( x, out, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains out-of-bounds indices', function test( t ) {
+ var values;
+ var out;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+ out = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ [ -10 ],
+ [ 20 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts = {
+ 'dims': value
+ };
+ minBy( x, out, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains too many indices', function test( t ) {
+ var values;
+ var out;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+ out = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ [ 0, 1, 2 ],
+ [ 0, 1, 2, 3 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts = {
+ 'dims': value
+ };
+ minBy( x, out, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains duplicate indices', function test( t ) {
+ var values;
+ var out;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+ out = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ [ 0, 0 ],
+ [ 1, 1 ],
+ [ 0, 1, 0 ],
+ [ 1, 0, 1 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts = {
+ 'dims': value
+ };
+ minBy( x, out, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an output array which has an invalid shape (default)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ [ 2, 2 ],
+ [ 2 ],
+ [ 4, 4 ],
+ [ 4 ],
+ [ 1 ],
+ [ 1, 1 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var out = zeros( value, {
+ 'dtype': 'generic'
+ });
+ minBy( x, out, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an output array which has an invalid shape (all dimensions)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ [ 2, 2 ],
+ [ 2 ],
+ [ 4, 4 ],
+ [ 4 ],
+ [ 1 ],
+ [ 1, 1 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts;
+ var out;
+
+ out = zeros( value, {
+ 'dtype': 'generic'
+ });
+ opts = {
+ 'dims': [ 0, 1 ]
+ };
+ minBy( x, out, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an output array which has an invalid shape (some dimensions)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ [],
+ [ 4, 4 ],
+ [ 4 ],
+ [ 1 ],
+ [ 1, 1 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts;
+ var out;
+
+ out = zeros( value, {
+ 'dtype': 'generic'
+ });
+ opts = {
+ 'dims': [ 0 ]
+ };
+ minBy( x, out, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function performs a reduction on an ndarray (default, row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var out;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ out = emptyLike( x, {
+ 'shape': []
+ });
+
+ actual = minBy( x, out, clbk );
+ expected = -30.0;
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function performs a reduction on an ndarray (default, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var out;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ out = emptyLike( x, {
+ 'shape': []
+ });
+
+ actual = minBy( x, out, clbk );
+ expected = -30.0;
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function performs a reduction on an ndarray (all dimensions, row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var out;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ out = emptyLike( x, {
+ 'shape': []
+ });
+
+ opts = {
+ 'dims': [ 0, 1 ]
+ };
+ actual = minBy( x, out, opts, clbk );
+ expected = -30.0;
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function performs a reduction on an ndarray (all dimensions, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var out;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ out = emptyLike( x, {
+ 'shape': []
+ });
+
+ opts = {
+ 'dims': [ 0, 1 ]
+ };
+ actual = minBy( x, out, opts, clbk );
+ expected = -30.0;
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function performs a reduction on an ndarray (no dimensions, row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var out;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ out = emptyLike( x, {
+ 'shape': [ 2, 2 ]
+ });
+
+ opts = {
+ 'dims': []
+ };
+ actual = minBy( x, out, opts, clbk );
+ expected = [ [ -10.0, 20.0 ], [ -30.0, 40.0 ] ];
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function performs a reduction on an ndarray (no dimensions, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var out;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ out = emptyLike( x, {
+ 'shape': [ 2, 2 ]
+ });
+
+ opts = {
+ 'dims': []
+ };
+ actual = minBy( x, out, opts, clbk );
+ expected = [ [ -10.0, -30.0 ], [ 20.0, 40.0 ] ];
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying reduction dimensions (row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var out;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ out = emptyLike( x, {
+ 'shape': [ 2 ]
+ });
+
+ opts = {
+ 'dims': [ 0 ]
+ };
+ actual = minBy( x, out, opts, clbk );
+ expected = [ -30.0, 20.0 ];
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ out = emptyLike( x, {
+ 'shape': [ 2 ]
+ });
+
+ opts = {
+ 'dims': [ 1 ]
+ };
+ actual = minBy( x, out, opts, clbk );
+ expected = [ -10.0, -30.0 ];
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying reduction dimensions (column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var out;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ out = emptyLike( x, {
+ 'shape': [ 2 ]
+ });
+
+ opts = {
+ 'dims': [ 0 ]
+ };
+ actual = minBy( x, out, opts, clbk );
+ expected = [ -10.0, -30.0 ];
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ out = emptyLike( x, {
+ 'shape': [ 2 ]
+ });
+
+ opts = {
+ 'dims': [ 1 ]
+ };
+ actual = minBy( x, out, opts, clbk );
+ expected = [ -30.0, 20.0 ];
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying the callback execution context (row-major)', function test( t ) {
+ var expected;
+ var indices;
+ var values;
+ var arrays;
+ var actual;
+ var xbuf;
+ var ctx;
+ var out;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ out = emptyLike( x, {
+ 'shape': []
+ });
+
+ indices = [];
+ values = [];
+ arrays = [];
+
+ ctx = {
+ 'count': 0
+ };
+ actual = minBy( x, out, fcn, ctx );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( ctx.count, 4, 'returns expected value' );
+
+ expected = -30.0;
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ expected = [
+ -1.0,
+ 2.0,
+ -3.0,
+ 4.0
+ ];
+ t.deepEqual( values, expected, 'returns expected value' );
+
+ expected = [
+ [ 0, 0 ],
+ [ 0, 1 ],
+ [ 1, 0 ],
+ [ 1, 1 ]
+ ];
+ t.deepEqual( indices, expected, 'returns expected value' );
+
+ expected = [
+ x,
+ x,
+ x,
+ x
+ ];
+ t.deepEqual( arrays, expected, 'returns expected value' );
+
+ t.end();
+
+ function fcn( value, idx, arr ) {
+ this.count += 1; // eslint-disable-line no-invalid-this
+ values.push( value );
+ indices.push( idx );
+ arrays.push( arr );
+ return value * 10.0;
+ }
+});
+
+tape( 'the function supports specifying the callback execution context (column-major)', function test( t ) {
+ var expected;
+ var indices;
+ var values;
+ var arrays;
+ var actual;
+ var xbuf;
+ var ctx;
+ var out;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'column-major' );
+
+ out = emptyLike( x, {
+ 'shape': []
+ });
+
+ indices = [];
+ values = [];
+ arrays = [];
+
+ ctx = {
+ 'count': 0
+ };
+ actual = minBy( x, out, fcn, ctx );
+
+ t.strictEqual( actual, out, 'returns expected value' );
+ t.strictEqual( ctx.count, 4, 'returns expected value' );
+
+ expected = -30.0;
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ expected = [
+ -1.0,
+ 2.0,
+ -3.0,
+ 4.0
+ ];
+ t.deepEqual( values, expected, 'returns expected value' );
+
+ expected = [
+ [ 0, 0 ],
+ [ 1, 0 ],
+ [ 0, 1 ],
+ [ 1, 1 ]
+ ];
+ t.deepEqual( indices, expected, 'returns expected value' );
+
+ expected = [
+ x,
+ x,
+ x,
+ x
+ ];
+ t.deepEqual( arrays, expected, 'returns expected value' );
+
+ t.end();
+
+ function fcn( value, idx, arr ) {
+ this.count += 1; // eslint-disable-line no-invalid-this
+ values.push( value );
+ indices.push( idx );
+ arrays.push( arr );
+ return value * 10.0;
+ }
+});
diff --git a/lib/node_modules/@stdlib/stats/min-by/test/test.js b/lib/node_modules/@stdlib/stats/min-by/test/test.js
new file mode 100644
index 000000000000..f6200d45f4c0
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/test/test.js
@@ -0,0 +1,39 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var isMethod = require( '@stdlib/assert/is-method' );
+var minBy = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof minBy, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'attached to the main export is an `assign` method', function test( t ) {
+ t.strictEqual( isMethod( minBy, 'assign' ), true, 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/stats/min-by/test/test.main.js b/lib/node_modules/@stdlib/stats/min-by/test/test.main.js
new file mode 100644
index 000000000000..522f49d6d78e
--- /dev/null
+++ b/lib/node_modules/@stdlib/stats/min-by/test/test.main.js
@@ -0,0 +1,1106 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2025 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var tape = require( 'tape' );
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getOrder = require( '@stdlib/ndarray/order' );
+var minBy = require( './../lib' );
+
+
+// FUNCTIONS //
+
+/**
+* Callback function.
+*
+* @private
+* @param {number} value - input value
+* @returns {number} accessed value
+*/
+function clbk( value ) {
+ return value * 10.0;
+}
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof minBy, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( value, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (thisArg)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( value, clbk, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (options)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( value, {}, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (options, thisArg)', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( value, {}, clbk, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ []
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, value, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (thisArg)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, value, clbk, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a callback argument which is not a function', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a callback argument which is not a function (thisArg)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a callback argument which is not a function (options)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, {}, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a callback argument which is not a function (options, thisArg)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ minBy( x, {}, value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dtype` option which is not a supported data type', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ 'foo',
+ 'bar',
+ 'beep',
+ 'boop'
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts = {
+ 'dtype': value
+ };
+ minBy( x, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `keepdims` option which is not a boolean', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts = {
+ 'keepdims': value
+ };
+ minBy( x, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which is not an array-like object of integers', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [ 'a' ],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts = {
+ 'dims': value
+ };
+ minBy( x, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains out-of-bounds indices', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ [ -10 ],
+ [ 0, 20 ],
+ [ 20 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts = {
+ 'dims': value
+ };
+ minBy( x, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains too many indices', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ [ 0, 1, 2 ],
+ [ 0, 1, 2, 3 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), RangeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts = {
+ 'dims': value
+ };
+ minBy( x, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains duplicate indices', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ [ 0, 0 ],
+ [ 1, 1 ],
+ [ 0, 1, 0 ],
+ [ 1, 0, 1 ]
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), Error, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ var opts = {
+ 'dims': value
+ };
+ minBy( x, opts, clbk );
+ };
+ }
+});
+
+tape( 'the function performs a reduction on an ndarray (default, row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ actual = minBy( x, clbk );
+ expected = -30.0;
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function performs a reduction on an ndarray (default, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = minBy( x, clbk );
+ expected = -30.0;
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function performs a reduction on an ndarray (all dimensions, row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ opts = {
+ 'dims': [ 0, 1 ]
+ };
+ actual = minBy( x, opts, clbk );
+ expected = -30.0;
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ opts = {
+ 'dims': [ 0, 1 ],
+ 'keepdims': false
+ };
+ actual = minBy( x, opts, clbk );
+ expected = -30.0;
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ opts = {
+ 'dims': [ 0, 1 ],
+ 'keepdims': true
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ [ -30.0 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 1, 1 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function performs a reduction on an ndarray (all dimensions, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ opts = {
+ 'dims': [ 0, 1 ]
+ };
+ actual = minBy( x, opts, clbk );
+ expected = -30.0;
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ opts = {
+ 'dims': [ 0, 1 ],
+ 'keepdims': false
+ };
+ actual = minBy( x, opts, clbk );
+ expected = -30.0;
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ opts = {
+ 'dims': [ 0, 1 ],
+ 'keepdims': true
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ [ -30.0 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 1, 1 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function performs a reduction on an ndarray (no dimensions, row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ opts = {
+ 'dims': [],
+ 'keepdims': false
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ [ -10.0, 20.0 ], [ -30.0, 40.0 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ opts = {
+ 'dims': [],
+ 'keepdims': true
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ [ -10.0, 20.0 ], [ -30.0, 40.0 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function performs a reduction on an ndarray (no dimensions, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ opts = {
+ 'dims': [],
+ 'keepdims': false
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ [ -10.0, -30.0 ], [ 20.0, 40.0 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ opts = {
+ 'dims': [],
+ 'keepdims': true
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ [ -10.0, -30.0 ], [ 20.0, 40.0 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying reduction dimensions (row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ opts = {
+ 'dims': [ 0 ],
+ 'keepdims': false
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ -30.0, 20.0 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ opts = {
+ 'dims': [ 0 ],
+ 'keepdims': true
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ [ -30.0, 20.0 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 1, 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ opts = {
+ 'dims': [ 1 ],
+ 'keepdims': false
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ -10.0, -30.0 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ opts = {
+ 'dims': [ 1 ],
+ 'keepdims': true
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ [ -10.0 ], [ -30.0 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 1 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying reduction dimensions (column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ opts = {
+ 'dims': [ 0 ],
+ 'keepdims': false
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ -10.0, -30.0 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ opts = {
+ 'dims': [ 0 ],
+ 'keepdims': true
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ [ -10.0, -30.0 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 1, 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ opts = {
+ 'dims': [ 1 ],
+ 'keepdims': false
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ -30.0, 20.0 ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ opts = {
+ 'dims': [ 1 ],
+ 'keepdims': true
+ };
+ actual = minBy( x, opts, clbk );
+ expected = [ [ -30.0 ], [ 20.0 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [ 2, 1 ], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying the output array data type', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var opts;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ opts = {
+ 'dtype': 'float64'
+ };
+ actual = minBy( x, opts, clbk );
+ expected = -30.0;
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'float64', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ opts = {
+ 'dtype': 'float64'
+ };
+ actual = minBy( x, opts, clbk );
+ expected = -30.0;
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'float64', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying the callback execution context (row-major)', function test( t ) {
+ var expected;
+ var indices;
+ var values;
+ var arrays;
+ var actual;
+ var xbuf;
+ var ctx;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+
+ indices = [];
+ values = [];
+ arrays = [];
+
+ ctx = {
+ 'count': 0
+ };
+ actual = minBy( x, fcn, ctx );
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+
+ t.strictEqual( ctx.count, 4, 'returns expected value' );
+
+ expected = -30.0;
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ expected = [
+ -1.0,
+ 2.0,
+ -3.0,
+ 4.0
+ ];
+ t.deepEqual( values, expected, 'returns expected value' );
+
+ expected = [
+ [ 0, 0 ],
+ [ 0, 1 ],
+ [ 1, 0 ],
+ [ 1, 1 ]
+ ];
+ t.deepEqual( indices, expected, 'returns expected value' );
+
+ expected = [
+ x,
+ x,
+ x,
+ x
+ ];
+ t.deepEqual( arrays, expected, 'returns expected value' );
+
+ t.end();
+
+ function fcn( value, idx, arr ) {
+ this.count += 1; // eslint-disable-line no-invalid-this
+ values.push( value );
+ indices.push( idx );
+ arrays.push( arr );
+ return value * 10.0;
+ }
+});
+
+tape( 'the function supports specifying the callback execution context (column-major)', function test( t ) {
+ var expected;
+ var indices;
+ var values;
+ var arrays;
+ var actual;
+ var xbuf;
+ var ctx;
+ var x;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'column-major' );
+
+ indices = [];
+ values = [];
+ arrays = [];
+
+ ctx = {
+ 'count': 0
+ };
+ actual = minBy( x, fcn, ctx );
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+
+ t.strictEqual( ctx.count, 4, 'returns expected value' );
+
+ expected = -30.0;
+ t.strictEqual( actual.get(), expected, 'returns expected value' );
+
+ expected = [
+ -1.0,
+ 2.0,
+ -3.0,
+ 4.0
+ ];
+ t.deepEqual( values, expected, 'returns expected value' );
+
+ expected = [
+ [ 0, 0 ],
+ [ 1, 0 ],
+ [ 0, 1 ],
+ [ 1, 1 ]
+ ];
+ t.deepEqual( indices, expected, 'returns expected value' );
+
+ expected = [
+ x,
+ x,
+ x,
+ x
+ ];
+ t.deepEqual( arrays, expected, 'returns expected value' );
+
+ t.end();
+
+ function fcn( value, idx, arr ) {
+ this.count += 1; // eslint-disable-line no-invalid-this
+ values.push( value );
+ indices.push( idx );
+ arrays.push( arr );
+ return value * 10.0;
+ }
+});