diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/README.md b/lib/node_modules/@stdlib/blas/ext/index-of/README.md
new file mode 100644
index 000000000000..c367c48c4405
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/README.md
@@ -0,0 +1,262 @@
+
+
+# indexOf
+
+> Return the first index of a specified search element along one or more [ndarray][@stdlib/ndarray/ctor] dimensions.
+
+
+
+## Usage
+
+```javascript
+var indexOf = require( '@stdlib/blas/ext/index-of' );
+```
+
+#### indexOf( x, searchElement\[, fromIndex]\[, options] )
+
+Returns the first index of a specified search element along one or more [ndarray][@stdlib/ndarray/ctor] dimensions.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+
+// Create an input ndarray:
+var x = array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
+// returns
+
+// Find index:
+var out = indexOf( x, 2.0 );
+// returns
+
+var idx = out.get();
+// returns 1
+```
+
+The function has the following parameters:
+
+- **x**: input [ndarray][@stdlib/ndarray/ctor].
+- **searchElement**: element in an input [ndarray][@stdlib/ndarray/ctor] for which to find an index. May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] same as the data type of the input [ndarray][@stdlib/ndarray/ctor]. If provided a scalar value, the value is cast to the data type of the input [ndarray][@stdlib/ndarray/ctor]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the complement of the shape defined by `options.dims`. For example, given the input shape `[2, 3, 4]` and `options.dims=[0]`, the search element [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. Similarly, when performing the operation over all elements in a provided input [ndarray][@stdlib/ndarray/ctor], the search element [ndarray][@stdlib/ndarray/ctor] must be a zero-dimensional [ndarray][@stdlib/ndarray/ctor].
+- **fromIndex**: index from which to begin searching (_optional_). May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] having an `integer` or `generic` [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the complement of the shape defined by `options.dims`. For example, given the input shape `[2, 3, 4]` and `options.dims=[0]`, an [ndarray][@stdlib/ndarray/ctor] containing the index from which to begin searching must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. Similarly, when performing the operation over all elements in a provided input [ndarray][@stdlib/ndarray/ctor], an [ndarray][@stdlib/ndarray/ctor] containing the index from which to begin searching must be a zero-dimensional [ndarray][@stdlib/ndarray/ctor]. By default, the index from which to begin searching is `0`.
+- **options**: function options (_optional_).
+
+The function accepts the following options:
+
+- **dtype**: output ndarray [data type][@stdlib/ndarray/dtypes]. Must be an integer or generic [data type][@stdlib/ndarray/dtypes].
+- **dims**: list of dimensions over which to perform operation. If not provided, the function performs the operation over all elements in a provided input [ndarray][@stdlib/ndarray/ctor].
+- **keepdims**: boolean indicating whether the reduced dimensions should be included in the returned [ndarray][@stdlib/ndarray/ctor] as singleton dimensions. Default: `false`.
+
+If the function is unable to find a search element, the function returns `-1`.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+
+// Create an input ndarray:
+var x = array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ] );
+// returns
+
+// Find index:
+var out = indexOf( x, 10.0 );
+// returns
+
+var idx = out.get();
+// returns -1
+```
+
+By default, the function uses `0` as the index from which to begin searching. To begin searching from a different index, provide the `fromIndex` argument.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+
+// Create an input ndarray:
+var x = array( [ 1.0, 2.0, 3.0, 4.0, 2.0, 6.0 ] );
+// returns
+
+// Find index:
+var out = indexOf( x, 2.0, 2 );
+// returns
+
+var idx = out.get();
+// returns 4
+```
+
+By default, the function performs the operation over all elements in a provided input [ndarray][@stdlib/ndarray/ctor]. To perform the operation over specific dimensions, provide a `dims` option.
+
+```javascript
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var array = require( '@stdlib/ndarray/array' );
+
+var x = array( [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ] );
+
+var out = indexOf( x, -3.0, {
+ 'dims': [ 0 ]
+});
+// returns
+
+var idx = ndarray2array( out );
+// returns [ 1, -1 ]
+```
+
+By default, the function returns an [`ndarray`][@stdlib/ndarray/ctor] having a shape matching only the non-reduced dimensions of the input [`ndarray`][@stdlib/ndarray/ctor] (i.e., the reduced dimensions are dropped). To include the reduced dimensions as singleton dimensions in the output [`ndarray`][@stdlib/ndarray/ctor], set the `keepdims` option to `true`.
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+
+// Create an input ndarray:
+var x = array( [ [ -1.0, 2.0 ], [ -3.0, 4.0 ] ] );
+// returns
+
+var opts = {
+ 'dims': [ 0 ],
+ 'keepdims': true
+};
+
+// Find index:
+var out = indexOf( x, -3.0, opts );
+// returns
+
+var idx = ndarray2array( out );
+// returns [ [ 1, -1 ] ]
+```
+
+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 ndarray2array = require( '@stdlib/ndarray/to-array' );
+var dtype = require( '@stdlib/ndarray/dtype' );
+var array = require( '@stdlib/ndarray/array' );
+
+var x = array( [ 1.0, 2.0, 3.0, 4.0 ] );
+
+var idx = indexOf( x, 2.0, {
+ 'dtype': 'int32'
+});
+// returns
+
+var dt = dtype( idx );
+// returns 'int32'
+```
+
+#### indexOf.assign( x, searchElement\[, fromIndex], out\[, options] )
+
+Returns the first index of a specified search element along one or more [ndarray][@stdlib/ndarray/ctor] dimensions and assigns results to a provided output [ndarray][@stdlib/ndarray/ctor].
+
+```javascript
+var array = require( '@stdlib/ndarray/array' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+
+var x = array( [ 1.0, 2.0, 3.0, 4.0 ] );
+var y = zeros( [], {
+ 'dtype': 'int32'
+});
+
+var out = indexOf.assign( x, 3.0, y );
+// returns
+
+var idx = out.get();
+// returns 2
+
+var bool = ( out === y );
+// returns true
+```
+
+The method has the following parameters:
+
+- **x**: input [ndarray][@stdlib/ndarray/ctor].
+- **searchElement**: element in an input [ndarray][@stdlib/ndarray/ctor] for which to find an index. May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] having a [data type][@stdlib/ndarray/dtypes] same as the data type of the input [ndarray][@stdlib/ndarray/ctor]. If provided a scalar value, the value is cast to the data type of the input [ndarray][@stdlib/ndarray/ctor]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the complement of the shape defined by `options.dims`. For example, given the input shape `[2, 3, 4]` and `options.dims=[0]`, the search element [ndarray][@stdlib/ndarray/ctor] must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. Similarly, when performing the operation over all elements in a provided input [ndarray][@stdlib/ndarray/ctor], an [ndarray][@stdlib/ndarray/ctor] initial value must be a zero-dimensional [ndarray][@stdlib/ndarray/ctor].
+- **fromIndex**: index from which to begin searching (_optional_). May be either a scalar value or an [ndarray][@stdlib/ndarray/ctor] having an `integer` or `generic` [data type][@stdlib/ndarray/dtypes]. If provided an [ndarray][@stdlib/ndarray/ctor], the value must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the complement of the shape defined by `options.dims`. For example, given the input shape `[2, 3, 4]` and `options.dims=[0]`, an [ndarray][@stdlib/ndarray/ctor] containing the index from which to begin searching must have a shape which is [broadcast-compatible][@stdlib/ndarray/base/broadcast-shapes] with the shape `[3, 4]`. Similarly, when performing the operation over all elements in a provided input [ndarray][@stdlib/ndarray/ctor], an [ndarray][@stdlib/ndarray/ctor] containing the index from which to begin searching must be a zero-dimensional [ndarray][@stdlib/ndarray/ctor]. By default, the index from which to begin searching is `0`.
+- **out**: output [ndarray][@stdlib/ndarray/ctor]. Must have an `integer` or `generic` [data type][@stdlib/ndarray/dtypes].
+- **options**: function options (_optional_).
+
+The method accepts the following options:
+
+- **dims**: list of dimensions over which to perform operation. If not provided, the function performs the operation over all elements in a provided input [ndarray][@stdlib/ndarray/ctor].
+
+
+
+
+
+
+
+## Notes
+
+- Both functions iterate over [ndarray][@stdlib/ndarray/ctor] elements according to the memory layout of the input [ndarray][@stdlib/ndarray/ctor]. Accordingly, performance degradation is possible when operating over multiple dimensions of a large non-contiguous multi-dimensional input [ndarray][@stdlib/ndarray/ctor]. In such scenarios, one may want to copy an input [ndarray][@stdlib/ndarray/ctor] to contiguous memory before searching for an index.
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var indexOf = require( '@stdlib/blas/ext/index-of' );
+
+// Generate an array of random numbers:
+var xbuf = discreteUniform( 10, 0, 20, {
+ 'dtype': 'float64'
+});
+
+// Wrap in an ndarray:
+var x = new ndarray( 'float64', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
+console.log( ndarray2array( x ) );
+
+// Find index:
+var idx = indexOf( x, 10.0, {
+ 'dims': [ 0 ]
+});
+
+// Print the results:
+console.log( ndarray2array( idx ) );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@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/blas/ext/index-of/benchmark/benchmark.assign.js b/lib/node_modules/@stdlib/blas/ext/index-of/benchmark/benchmark.assign.js
new file mode 100644
index 000000000000..47e739512b04
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/benchmark/benchmark.assign.js
@@ -0,0 +1,113 @@
+/**
+* @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/ndarray/zeros' );
+var ndarray = require( '@stdlib/ndarray/base/ctor' );
+var pkg = require( './../package.json' ).name;
+var indexOf = require( './../lib' );
+
+
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
+// FUNCTIONS //
+
+/**
+* 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 = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ 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 = indexOf.assign( x, 10.0, out );
+ 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/blas/ext/index-of/benchmark/benchmark.js b/lib/node_modules/@stdlib/blas/ext/index-of/benchmark/benchmark.js
new file mode 100644
index 000000000000..959df5a92fcc
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/benchmark/benchmark.js
@@ -0,0 +1,105 @@
+/**
+* @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 indexOf = require( './../lib' );
+
+
+// VARIABLES //
+
+var options = {
+ 'dtype': 'float64'
+};
+
+
+// FUNCTIONS //
+
+/**
+* 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 = indexOf( x, 10.0 );
+ 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/blas/ext/index-of/docs/repl.txt b/lib/node_modules/@stdlib/blas/ext/index-of/docs/repl.txt
new file mode 100644
index 000000000000..71badada0d9e
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/docs/repl.txt
@@ -0,0 +1,126 @@
+
+{{alias}}( x, searchElement[, fromIndex][, options] )
+ Returns the first index of a specified search element along one or more
+ ndarray dimensions.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array.
+
+ searchElement: ndarray|*
+ Element in an input ndarray for which to find an index. May be either a
+ scalar value or an ndarray having a data type same as the data type of
+ the input ndarray. If provided a scalar value, the value is cast to the
+ data type of the input ndarray. If provided an ndarray, the value must
+ have a shape which is broadcast compatible with the complement of the
+ shape defined by `options.dims`. For example, given the input shape
+ `[2, 3, 4]` and `options.dims=[0]`, the search element ndarray must have
+ a shape which is broadcast-compatible with the shape `[3, 4]`. Similarly
+ when performing the operation over all elements in a provided input
+ ndarray, a search element ndarray must be a zero-dimensional ndarray.
+
+ fromIndex: ndarray|integer (optional)
+ Index from which to begin searching. May be either a scalar value or an
+ ndarray having an `integer` or `generic` data type. If provided an
+ ndarray the value must have a shape which is broadcast compatible with
+ the complement of the shape defined by `options.dims`. For example,
+ given the input shape `[2, 3, 4]` and `options.dims=[0]`, an ndarray
+ containing the index from which to begin searching must have a shape
+ which is broadcast-compatible with the shape `[3, 4]`. Similarly
+ when performing the operation over all elements in a provided input
+ ndarray, an ndarray containing the index from which to begin searching
+ must be a zero-dimensional ndarray. By default, the index
+ from which to begin searching is `0`.
+
+ options: Object (optional)
+ Function options.
+
+ options.dtype: string (optional)
+ Output array data type. Must be an integer 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.
+
+ Returns
+ -------
+ out: ndarray
+ Output array.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ -1.0, 2.0, -3.0, -4.0 ] );
+ > var y = {{alias}}( x, 2.0 );
+ > var v = y.get()
+ 1.0
+
+
+{{alias}}.assign( x, searchElement[, fromIndex], out[, options] )
+ Returns the first index of a specified search element along one or more
+ ndarray dimensions and assigns results to a provided output ndarray.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array.
+
+ searchElement: ndarray|*
+ Element in an input ndarray for which to find an index. May be either a
+ scalar value or an ndarray having a data type same as the data type of
+ the input ndarray. If provided a scalar value, the value is cast to the
+ data type of the input ndarray. If provided an ndarray, the value must
+ have a shape which is broadcast compatible with the complement of the
+ shape defined by `options.dims`. For example, given the input shape
+ `[2, 3, 4]` and `options.dims=[0]`, the search element ndarray must have
+ a shape which is broadcast-compatible with the shape `[3, 4]`. Similarly
+ when performing the operation over all elements in a provided input
+ ndarray, a search element ndarray must be a zero-dimensional ndarray.
+
+ fromIndex: ndarray|integer (optional)
+ Index from which to begin searching. May be either a scalar value or an
+ ndarray having an `integer` or `generic` data type. If provided an
+ ndarray the value must have a shape which is broadcast compatible with
+ the complement of the shape defined by `options.dims`. For example,
+ given the input shape `[2, 3, 4]` and `options.dims=[0]`, an ndarray
+ containing the index from which to begin searching must have a shape
+ which is broadcast-compatible with the shape `[3, 4]`. Similarly
+ when performing the operation over all elements in a provided input
+ ndarray, an ndarray containing the index from which to begin searching
+ must be a zero-dimensional ndarray. By default, the value of the index
+ from which to begin searching is `0`.
+
+ 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.
+
+ 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}}( [], { 'dtype': 'int32' } );
+ > var y = {{alias}}.assign( x, 2.0, out )
+
+ > var bool = ( out === y )
+ true
+ > var v = out.get()
+ 1.0
+
+ See Also
+ --------
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/docs/types/index.d.ts b/lib/node_modules/@stdlib/blas/ext/index-of/docs/types/index.d.ts
new file mode 100644
index 000000000000..5b5c2be833cc
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/docs/types/index.d.ts
@@ -0,0 +1,222 @@
+/*
+* @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 { IntegerIndexAndGenericDataType as DataType, typedndarray } from '@stdlib/types/ndarray';
+
+/**
+* Input array.
+*/
+type InputArray = typedndarray;
+
+/**
+* Search element.
+*/
+type SearchElement = typedndarray | T;
+
+/**
+* From index.
+*/
+type FromIndex = typedndarray | number;
+
+/**
+* Output array.
+*/
+type OutputArray = typedndarray;
+
+/**
+* Interface defining "base" options.
+*/
+interface BaseOptions {
+ /**
+ * List of dimensions over which to perform operation.
+ */
+ 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 describing `indexOf`.
+*/
+interface IndexOf {
+ /**
+ * Returns the first index of specified search element along one or more ndarray dimensions.
+ *
+ * @param x - input ndarray
+ * @param searchElement - search element
+ * @param options - function options
+ * @returns output ndarray
+ *
+ * @example
+ * var array = require( '@stdlib/ndarray/array' );
+ *
+ * var x = array( [ -1.0, 2.0, -3.0 ] );
+ *
+ * var y = indexOf( x, 2.0 );
+ * // returns
+ *
+ * var idx = y.get();
+ * // returns 1
+ */
+ ( x: InputArray, searchElement: SearchElement, options?: Options ): OutputArray;
+
+ /**
+ * Returns the first index of specified search element along one or more ndarray dimensions.
+ *
+ * @param x - input ndarray
+ * @param searchElement - search element
+ * @param fromIndex - index from which to begin searching
+ * @param options - function options
+ * @returns output ndarray
+ *
+ * @example
+ * var array = require( '@stdlib/ndarray/array' );
+ *
+ * var x = array( [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
+ *
+ * var y = indexOf( x, 2.0, 2 );
+ * // returns
+ *
+ * var idx = y.get();
+ * // returns 3
+ */
+ ( x: InputArray, searchElement: SearchElement, fromIndex: FromIndex, options?: Options ): OutputArray;
+
+ /**
+ * Returns the first index of a specified search element along one or more ndarray dimensions and assigns results to a provided output ndarray.
+ *
+ * @param x - input ndarray
+ * @param searchElement - search element
+ * @param out - output ndarray
+ * @param options - function options
+ * @returns output ndarray
+ *
+ * @example
+ * var zeros = require( '@stdlib/ndarray/zeros' );
+ * var array = require( '@stdlib/ndarray/array' );
+ *
+ * var x = array( [ -1.0, 2.0, -3.0 ] );
+ * var y = zeros( [], {
+ * 'dtype': 'int32'
+ * } );
+ *
+ * var out = indexOf.assign( x, 2.0, y );
+ * // returns
+ *
+ * var bool = ( out === y );
+ * // returns true
+ *
+ * var idx = out.get();
+ * // returns 1
+ */
+ assign( x: InputArray, searchElement: SearchElement, out: U, options?: BaseOptions ): U;
+
+ /**
+ * Returns the first index of a specified search element along one or more ndarray dimensions and assigns results to a provided output ndarray.
+ *
+ * @param x - input ndarray
+ * @param searchElement - search element
+ * @param fromIndex - index from which to begin searching
+ * @param out - output ndarray
+ * @param options - function options
+ * @returns output ndarray
+ *
+ * @example
+ * var zeros = require( '@stdlib/ndarray/zeros' );
+ * var array = require( '@stdlib/ndarray/array' );
+ *
+ * var x = array( [ -1.0, 2.0, -3.0, 2.0, -5.0, 6.0 ] );
+ * var y = zeros( [], {
+ * 'dtype': 'int32'
+ * } );
+ *
+ * var out = indexOf.assign( x, 2.0, 2, y );
+ * // returns
+ *
+ * var bool = ( out === y );
+ * // returns true
+ *
+ * var idx = out.get();
+ * // returns 3
+ */
+ assign( x: InputArray, searchElement: SearchElement, fromIndex: FromIndex, out: U, options?: BaseOptions ): U;
+}
+
+/**
+* Returns the first index of a specified search element along one or more ndarray dimensions.
+*
+* @param x - input ndarray
+* @param searchElement - search element
+* @param fromIndex - index from which to begin searching
+* @param options - function options
+* @returns output ndarray
+*
+* @example
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ -1.0, 2.0, -3.0 ] );
+*
+* var y = indexOf( x, 2.0 );
+* // returns
+*
+* var idx = y.get();
+* // returns 1
+*
+* @example
+* var zeros = require( '@stdlib/ndarray/zeros' );
+* var array = require( '@stdlib/ndarray/array' );
+*
+* var x = array( [ -1.0, 2.0, -3.0 ] );
+* var y = zeros( x, {
+* 'dtype': 'int32'
+* } );
+*
+* var out = indexOf.assign( x, 2.0, y );
+* // returns
+*
+* var bool = ( out === y );
+* // returns true
+*
+* var idx = out.get();
+* // returns 1
+*/
+declare const indexOf: IndexOf;
+
+
+// EXPORTS //
+
+export = indexOf;
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/docs/types/test.ts b/lib/node_modules/@stdlib/blas/ext/index-of/docs/types/test.ts
new file mode 100644
index 000000000000..e528cd208c7a
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/docs/types/test.ts
@@ -0,0 +1,460 @@
+/*
+* @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 indexOf = require( './index' );
+
+
+// TESTS //
+
+// The function returns an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ indexOf( x, 0.0 ); // $ExpectType OutputArray
+ indexOf( x, 0.0, 1 ); // $ExpectType OutputArray
+ indexOf( x, 0.0, {} ); // $ExpectType OutputArray
+ indexOf( x, 0.0, 1, {} ); // $ExpectType OutputArray
+}
+
+// The compiler throws an error if the function is provided a first argument which is not an ndarray...
+{
+ indexOf( '5', 0.0 ); // $ExpectError
+ indexOf( 5, 0.0 ); // $ExpectError
+ indexOf( true, 0.0 ); // $ExpectError
+ indexOf( false, 0.0 ); // $ExpectError
+ indexOf( null, 0.0 ); // $ExpectError
+ indexOf( void 0, 0.0 ); // $ExpectError
+ indexOf( {}, 0.0 ); // $ExpectError
+ indexOf( ( x: number ): number => x, 0.0 ); // $ExpectError
+
+ indexOf( '5', 0.0, 0 ); // $ExpectError
+ indexOf( 5, 0.0, 0 ); // $ExpectError
+ indexOf( true, 0.0, 0 ); // $ExpectError
+ indexOf( false, 0.0, 0 ); // $ExpectError
+ indexOf( null, 0.0, 0 ); // $ExpectError
+ indexOf( void 0, 0.0, 0 ); // $ExpectError
+ indexOf( {}, 0.0, 0 ); // $ExpectError
+ indexOf( ( x: number ): number => x, 0.0, 0 ); // $ExpectError
+
+ indexOf( '5', 0.0, {} ); // $ExpectError
+ indexOf( 5, 0.0, {} ); // $ExpectError
+ indexOf( true, 0.0, {} ); // $ExpectError
+ indexOf( false, 0.0, {} ); // $ExpectError
+ indexOf( null, 0.0, {} ); // $ExpectError
+ indexOf( void 0, 0.0, {} ); // $ExpectError
+ indexOf( {}, 0.0, {} ); // $ExpectError
+ indexOf( ( x: number ): number => x, 0.0, {} ); // $ExpectError
+
+ indexOf( '5', 0.0, 0, {} ); // $ExpectError
+ indexOf( 5, 0.0, 0, {} ); // $ExpectError
+ indexOf( true, 0.0, 0, {} ); // $ExpectError
+ indexOf( false, 0.0, 0, {} ); // $ExpectError
+ indexOf( null, 0.0, 0, {} ); // $ExpectError
+ indexOf( void 0, 0.0, 0, {} ); // $ExpectError
+ indexOf( {}, 0.0, 0, {} ); // $ExpectError
+ indexOf( ( x: number ): number => x, 0.0, 0, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a search element argument which is not an ndarray or scalar value...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ indexOf( x, '5' ); // $ExpectError
+ indexOf( x, true ); // $ExpectError
+ indexOf( x, false ); // $ExpectError
+ indexOf( x, [] ); // $ExpectError
+ indexOf( x, ( x: number ): number => x ); // $ExpectError
+
+ indexOf( x, '5', 0 ); // $ExpectError
+ indexOf( x, true, 0 ); // $ExpectError
+ indexOf( x, false, 0 ); // $ExpectError
+ indexOf( x, [], 0 ); // $ExpectError
+ indexOf( x, ( x: number ): number => x, 0 ); // $ExpectError
+
+ indexOf( x, '5', {} ); // $ExpectError
+ indexOf( x, true, {} ); // $ExpectError
+ indexOf( x, false, {} ); // $ExpectError
+ indexOf( x, [], {} ); // $ExpectError
+ indexOf( x, ( x: number ): number => x, {} ); // $ExpectError
+
+ indexOf( x, '5', 0, {} ); // $ExpectError
+ indexOf( x, true, 0, {} ); // $ExpectError
+ indexOf( x, false, 0, {} ); // $ExpectError
+ indexOf( x, [], 0, {} ); // $ExpectError
+ indexOf( x, ( x: number ): number => x, 0, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a from index argument which is not an ndarray or an integer value...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ indexOf( x, 0.0, '5' ); // $ExpectError
+ indexOf( x, 0.0, true ); // $ExpectError
+ indexOf( x, 0.0, false ); // $ExpectError
+ indexOf( x, 0.0, [] ); // $ExpectError
+ indexOf( x, 0.0, ( x: number ): number => x ); // $ExpectError
+
+ indexOf( x, 0.0, '5' ); // $ExpectError
+ indexOf( x, 0.0, true ); // $ExpectError
+ indexOf( x, 0.0, false ); // $ExpectError
+ indexOf( x, 0.0, [] ); // $ExpectError
+ indexOf( x, 0.0, ( x: number ): number => x ); // $ExpectError
+
+ indexOf( x, 0.0, '5', {} ); // $ExpectError
+ indexOf( x, 0.0, true, {} ); // $ExpectError
+ indexOf( x, 0.0, false, {} ); // $ExpectError
+ indexOf( x, 0.0, [], {} ); // $ExpectError
+ indexOf( x, 0.0, ( x: number ): number => x, {} ); // $ExpectError
+
+ indexOf( x, 0.0, '5', {} ); // $ExpectError
+ indexOf( x, 0.0, true, {} ); // $ExpectError
+ indexOf( x, 0.0, false, {} ); // $ExpectError
+ indexOf( x, 0.0, [], {} ); // $ExpectError
+ indexOf( x, 0.0, ( x: number ): number => x, {} ); // $ExpectError
+}
+
+
+// The compiler throws an error if the function is provided a options argument which is not an object...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ indexOf( x, 0.0, '5' ); // $ExpectError
+ indexOf( x, 0.0, true ); // $ExpectError
+ indexOf( x, 0.0, false ); // $ExpectError
+ indexOf( x, 0.0, [] ); // $ExpectError
+ indexOf( x, 0.0, ( x: number ): number => x ); // $ExpectError
+
+ indexOf( x, 0.0, 0, '5' ); // $ExpectError
+ indexOf( x, 0.0, 0, true ); // $ExpectError
+ indexOf( x, 0.0, 0, false ); // $ExpectError
+ indexOf( x, 0.0, 0, null ); // $ExpectError
+ indexOf( x, 0.0, 0, [] ); // $ExpectError
+ indexOf( x, 0.0, 0, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid `dtype` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ indexOf( x, 0.0, { 'dtype': '5' } ); // $ExpectError
+ indexOf( x, 0.0, { 'dtype': 5 } ); // $ExpectError
+ indexOf( x, 0.0, { 'dtype': true } ); // $ExpectError
+ indexOf( x, 0.0, { 'dtype': false } ); // $ExpectError
+ indexOf( x, 0.0, { 'dtype': null } ); // $ExpectError
+ indexOf( x, 0.0, { 'dtype': [] } ); // $ExpectError
+ indexOf( x, 0.0, { 'dtype': {} } ); // $ExpectError
+ indexOf( x, 0.0, { 'dtype': ( x: number ): number => x } ); // $ExpectError
+
+ indexOf( x, 0.0, 0, { 'dtype': '5' } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dtype': 5 } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dtype': true } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dtype': false } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dtype': null } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dtype': [] } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dtype': {} } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dtype': ( x: number ): number => x } ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid `dims` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ indexOf( x, 0.0, { 'dims': '5' } ); // $ExpectError
+ indexOf( x, 0.0, { 'dims': 5 } ); // $ExpectError
+ indexOf( x, 0.0, { 'dims': true } ); // $ExpectError
+ indexOf( x, 0.0, { 'dims': false } ); // $ExpectError
+ indexOf( x, 0.0, { 'dims': null } ); // $ExpectError
+ indexOf( x, 0.0, { 'dims': {} } ); // $ExpectError
+ indexOf( x, 0.0, { 'dims': ( x: number ): number => x } ); // $ExpectError
+
+ indexOf( x, 0.0, 0, { 'dims': '5' } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dims': 5 } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dims': true } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dims': false } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dims': null } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dims': {} } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'dims': ( x: number ): number => x } ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an invalid `keepdims` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ indexOf( x, 0.0, { 'keepdims': '5' } ); // $ExpectError
+ indexOf( x, 0.0, { 'keepdims': 5 } ); // $ExpectError
+ indexOf( x, 0.0, { 'keepdims': null } ); // $ExpectError
+ indexOf( x, 0.0, { 'keepdims': {} } ); // $ExpectError
+ indexOf( x, 0.0, { 'keepdims': ( x: number ): number => x } ); // $ExpectError
+
+ indexOf( x, 0.0, 0, { 'keepdims': '5' } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'keepdims': 5 } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'keepdims': null } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'keepdims': {} } ); // $ExpectError
+ indexOf( x, 0.0, 0, { 'keepdims': ( x: number ): number => x } ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ indexOf(); // $ExpectError
+ indexOf( x, 0.0, 0, {}, {} ); // $ExpectError
+}
+
+// Attached to the function is an `assign` method which returns an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ indexOf.assign( x, 0.0, y ); // $ExpectType int32ndarray
+ indexOf.assign( x, 0.0, y, {} ); // $ExpectType int32ndarray
+ indexOf.assign( x, 0.0, 1, y ); // $ExpectType int32ndarray
+ indexOf.assign( x, 0.0, 1, y, {} ); // $ExpectType int32ndarray
+}
+
+// The compiler throws an error if the `assign` method is provided a first argument which is not an ndarray...
+{
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ indexOf.assign( '5', 0.0, y ); // $ExpectError
+ indexOf.assign( 5, 0.0, y ); // $ExpectError
+ indexOf.assign( true, 0.0, y ); // $ExpectError
+ indexOf.assign( false, 0.0, y ); // $ExpectError
+ indexOf.assign( null, 0.0, y ); // $ExpectError
+ indexOf.assign( void 0, 0.0, y ); // $ExpectError
+ indexOf.assign( {}, 0.0, y ); // $ExpectError
+ indexOf.assign( ( x: number ): number => x, 0.0, y ); // $ExpectError
+
+ indexOf.assign( '5', 0.0, 0, y ); // $ExpectError
+ indexOf.assign( 5, 0.0, 0, y ); // $ExpectError
+ indexOf.assign( true, 0.0, 0, y ); // $ExpectError
+ indexOf.assign( false, 0.0, 0, y ); // $ExpectError
+ indexOf.assign( null, 0.0, 0, y ); // $ExpectError
+ indexOf.assign( void 0, 0.0, 0, y ); // $ExpectError
+ indexOf.assign( {}, 0.0, 0, y ); // $ExpectError
+ indexOf.assign( ( x: number ): number => x, 0.0, 0, y ); // $ExpectError
+
+ indexOf.assign( '5', 0.0, y, {} ); // $ExpectError
+ indexOf.assign( 5, 0.0, y, {} ); // $ExpectError
+ indexOf.assign( true, 0.0, y, {} ); // $ExpectError
+ indexOf.assign( false, 0.0, y, {} ); // $ExpectError
+ indexOf.assign( null, 0.0, y, {} ); // $ExpectError
+ indexOf.assign( void 0, 0.0, y, {} ); // $ExpectError
+ indexOf.assign( {}, 0.0, y, {} ); // $ExpectError
+ indexOf.assign( ( x: number ): number => x, 0.0, y, {} ); // $ExpectError
+
+ indexOf.assign( '5', 0.0, 0, y, {} ); // $ExpectError
+ indexOf.assign( 5, 0.0, 0, y, {} ); // $ExpectError
+ indexOf.assign( true, 0.0, 0, y, {} ); // $ExpectError
+ indexOf.assign( false, 0.0, 0, y, {} ); // $ExpectError
+ indexOf.assign( null, 0.0, 0, y, {} ); // $ExpectError
+ indexOf.assign( void 0, 0.0, 0, y, {} ); // $ExpectError
+ indexOf.assign( {}, 0.0, 0, y, {} ); // $ExpectError
+ indexOf.assign( ( x: number ): number => x, 0.0, 0, y, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided a search element argument which is not an ndarray or scalar value...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ indexOf.assign( x, '5', y ); // $ExpectError
+ indexOf.assign( x, true, y ); // $ExpectError
+ indexOf.assign( x, false, y ); // $ExpectError
+ indexOf.assign( x, {}, y ); // $ExpectError
+ indexOf.assign( x, ( x: number ): number => x, y ); // $ExpectError
+
+ indexOf.assign( x, '5', 0, y ); // $ExpectError
+ indexOf.assign( x, true, 0, y ); // $ExpectError
+ indexOf.assign( x, false, 0, y ); // $ExpectError
+ indexOf.assign( x, {}, 0, y ); // $ExpectError
+ indexOf.assign( x, ( x: number ): number => x, 0, y ); // $ExpectError
+
+ indexOf.assign( x, '5', y, {} ); // $ExpectError
+ indexOf.assign( x, true, y, {} ); // $ExpectError
+ indexOf.assign( x, false, y, {} ); // $ExpectError
+ indexOf.assign( x, {}, y, {} ); // $ExpectError
+ indexOf.assign( x, ( x: number ): number => x, y, {} ); // $ExpectError
+
+ indexOf.assign( x, '5', 0, y, {} ); // $ExpectError
+ indexOf.assign( x, true, 0, y, {} ); // $ExpectError
+ indexOf.assign( x, false, 0, y, {} ); // $ExpectError
+ indexOf.assign( x, {}, 0, y, {} ); // $ExpectError
+ indexOf.assign( x, ( x: number ): number => x, 0, y, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided a from index argument which is not an ndarray or an integer value...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ indexOf.assign( x, 0.0, '5', y ); // $ExpectError
+ indexOf.assign( x, 0.0, true, y ); // $ExpectError
+ indexOf.assign( x, 0.0, false, y ); // $ExpectError
+ indexOf.assign( x, 0.0, null, y ); // $ExpectError
+ indexOf.assign( x, 0.0, void 0, y ); // $ExpectError
+ indexOf.assign( x, 0.0, {}, y ); // $ExpectError
+ indexOf.assign( x, 0.0, ( x: number ): number => x, y ); // $ExpectError
+
+ indexOf.assign( x, 0.0, '5', y, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, true, y, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, false, y, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, null, y, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, void 0, y, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, {}, y, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, ( x: number ): number => x, y, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided a output argument which is not an ndarray...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ indexOf.assign( x, 0.0, '5' ); // $ExpectError
+ indexOf.assign( x, 0.0, 5 ); // $ExpectError
+ indexOf.assign( x, 0.0, true ); // $ExpectError
+ indexOf.assign( x, 0.0, false ); // $ExpectError
+ indexOf.assign( x, 0.0, null ); // $ExpectError
+ indexOf.assign( x, 0.0, void 0 ); // $ExpectError
+ indexOf.assign( x, 0.0, ( x: number ): number => x ); // $ExpectError
+
+ indexOf.assign( x, 0.0, '5', {} ); // $ExpectError
+ indexOf.assign( x, 0.0, 5, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, true, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, false, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, null, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, void 0, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, ( x: number ): number => x, {} ); // $ExpectError
+
+ indexOf.assign( x, 0.0, 1, '5' ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, 5 ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, true ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, false ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, null ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, void 0 ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, ( x: number ): number => x ); // $ExpectError
+
+ indexOf.assign( x, 0.0, 1, '5', {} ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, 5, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, true, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, false, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, null, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, void 0, {} ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, ( x: number ): number => x, {} ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided a options argument which is not an object...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ indexOf.assign( x, 0.0, y, '5' ); // $ExpectError
+ indexOf.assign( x, 0.0, y, true ); // $ExpectError
+ indexOf.assign( x, 0.0, y, false ); // $ExpectError
+ indexOf.assign( x, 0.0, y, null ); // $ExpectError
+ indexOf.assign( x, 0.0, y, [] ); // $ExpectError
+ indexOf.assign( x, 0.0, y, ( x: number ): number => x ); // $ExpectError
+
+ indexOf.assign( x, 0.0, 1, y, '5' ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, true ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, false ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, null ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, [] ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, ( x: number ): number => x ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided an invalid `dims` option...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ indexOf.assign( x, 0.0, y, { 'dims': '5' } ); // $ExpectError
+ indexOf.assign( x, 0.0, y, { 'dims': 5 } ); // $ExpectError
+ indexOf.assign( x, 0.0, y, { 'dims': true } ); // $ExpectError
+ indexOf.assign( x, 0.0, y, { 'dims': false } ); // $ExpectError
+ indexOf.assign( x, 0.0, y, { 'dims': null } ); // $ExpectError
+ indexOf.assign( x, 0.0, y, { 'dims': {} } ); // $ExpectError
+ indexOf.assign( x, 0.0, y, { 'dims': ( x: number ): number => x } ); // $ExpectError
+
+ indexOf.assign( x, 0.0, 1, y, { 'dims': '5' } ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, { 'dims': 5 } ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, { 'dims': true } ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, { 'dims': false } ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, { 'dims': null } ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, { 'dims': {} } ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, { 'dims': ( x: number ): number => x } ); // $ExpectError
+}
+
+// The compiler throws an error if the `assign` method is provided an unsupported number of arguments...
+{
+ const x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ const y = zeros( [], {
+ 'dtype': 'int32'
+ });
+
+ indexOf.assign(); // $ExpectError
+ indexOf.assign( x ); // $ExpectError
+ indexOf.assign( x, 0.0 ); // $ExpectError
+ indexOf.assign( x, 0.0, 1, y, {}, {} ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/examples/index.js b/lib/node_modules/@stdlib/blas/ext/index-of/examples/index.js
new file mode 100644
index 000000000000..f8c44f943927
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/examples/index.js
@@ -0,0 +1,41 @@
+/**
+* @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 discreteUniform = require( '@stdlib/random/array/discrete-uniform' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var indexOf = require( './../lib' );
+
+// Generate an array of random numbers:
+var xbuf = discreteUniform( 10, 0, 20, {
+ 'dtype': 'float64'
+});
+
+// Wrap in an ndarray:
+var x = new ndarray( 'float64', xbuf, [ 5, 2 ], [ 2, 1 ], 0, 'row-major' );
+console.log( ndarray2array( x ) );
+
+// Find index:
+var idx = indexOf( x, 10.0, {
+ 'dims': [ 0 ]
+});
+
+// Print the results:
+console.log( ndarray2array( idx ) );
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/lib/assign.js b/lib/node_modules/@stdlib/blas/ext/index-of/lib/assign.js
new file mode 100644
index 000000000000..f6f80cd0354d
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/lib/assign.js
@@ -0,0 +1,178 @@
+/**
+* @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 hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var objectAssign = require( '@stdlib/object/assign' );
+var isObject = require( '@stdlib/assert/is-object' );
+var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var broadcastScalar = require( '@stdlib/ndarray/base/broadcast-scalar' );
+var maybeBroadcastArray = require( '@stdlib/ndarray/base/maybe-broadcast-array' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getOrder = require( '@stdlib/ndarray/order' );
+var format = require( '@stdlib/string/format' );
+var defaults = require( '@stdlib/ndarray/defaults' );
+var nonCoreShape = require( './non_core_shape.js' );
+var base = require( './base.js' ).assign;
+
+
+// VARIABLES //
+
+var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
+
+
+// MAIN //
+
+/**
+* Returns the first index of a specified search element along one or more ndarray dimensions and assigns the results to a provided output ndarray.
+*
+* @name assign
+* @type {Function}
+* @param {ndarrayLike} x - input ndarray
+* @param {(ndarrayLike|*)} searchElement - search element
+* @param {(ndarrayLike|integer)} [fromIndex] - index from which to begin searching
+* @param {ndarrayLike} out - output ndarray
+* @param {Options} [options] - function options
+* @param {IntegerArray} [options.dims] - list of dimensions over which to perform operation
+* @throws {TypeError} function must be provided at least three arguments
+* @throws {TypeError} first argument must be an ndarray-like object
+* @throws {TypeError} third argument must be either an ndarray-like object or an integer
+* @throws {TypeError} fourth argument must be an ndarray-like object
+* @throws {TypeError} options argument must be an object
+* @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 zeros = require( '@stdlib/ndarray/zeros' );
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+*
+* // Create data buffers:
+* var xbuf = new Float64Array( [ 1.0, 2.0, -3.0, 4.0, -5.0, 6.0 ] );
+*
+* // Define the shape of the input array:
+* var shape = [ 3, 1, 2 ];
+*
+* // Define the array strides:
+* var strides = [ 2, 2, 1 ];
+*
+* // Define the index offset:
+* var offset = 0;
+*
+* // Create an input ndarray:
+* var x = new ndarray( 'float64', xbuf, shape, strides, offset, 'row-major' );
+*
+* // Create an output ndarray:
+* var y = zeros( [], {
+* 'dtype': 'int32'
+* });
+*
+* // Perform operation:
+* var out = assign( x, 4.0, y );
+* // returns
+*
+* var bool = ( out === y );
+* // returns true
+*
+* var idx = out.get();
+* // returns 3
+*/
+function assign( x, searchElement, fromIndex, out, options ) {
+ var nargs;
+ var opts;
+ var ord;
+ var dt;
+ var sh;
+
+ nargs = arguments.length;
+ if ( nargs < 3 ) {
+ throw new TypeError( format( 'invalid argument. The function must be provided at least three arguments. Value: `%s`.', nargs ) );
+ }
+
+ if ( !isndarrayLike( x ) ) {
+ throw new TypeError( format( 'invalid argument. The first argument must be an ndarray-like object. Value: `%s`.', x ) );
+ }
+
+ // Resolve input ndarray meta data:
+ dt = getDType( x );
+ ord = getOrder( x );
+
+ // Initialize options object:
+ opts = {};
+
+ // Case: assign( x, searchElement, out )
+ if ( nargs === 3 ) {
+ out = fromIndex;
+ fromIndex = 0;
+ }
+ // Case: assign( x, searchElement, out, options )
+ else if (
+ nargs === 4 &&
+ isndarrayLike( fromIndex ) &&
+ !isndarrayLike( out ) &&
+ isObject( out )
+ ) {
+ opts = objectAssign( opts, out );
+ out = fromIndex;
+ fromIndex = 0;
+ }
+ // Case: assign( x, searchElement, fromIndex, out, options )
+ else if ( nargs === 5 ) {
+ if ( !isObject( options ) ) {
+ throw new TypeError( format( 'invalid argument. The fifth argument must be an object. Value: `%s`.', options ) );
+ }
+ opts = objectAssign( opts, options );
+ }
+
+ // Resolve shape for broadcasting
+ if ( hasOwnProp( opts, 'dims' ) ) {
+ sh = nonCoreShape( getShape( x ), opts.dims );
+ } else {
+ sh = [];
+ }
+
+ // Normalize search element:
+ if ( isndarrayLike( searchElement ) ) {
+ searchElement = maybeBroadcastArray( searchElement, sh );
+ } else {
+ searchElement = broadcastScalar( searchElement, dt, sh, ord );
+ }
+
+ // Normalize from index:
+ if ( isndarrayLike( fromIndex ) ) {
+ fromIndex = maybeBroadcastArray( fromIndex, sh );
+ } else if ( isInteger( fromIndex ) ) {
+ fromIndex = broadcastScalar( fromIndex, DEFAULT_DTYPE, sh, ord );
+ } else {
+ throw new TypeError( format( 'invalid argument. Third argument must be either an ndarray or an integer. Value: `%s`.', fromIndex ) );
+ }
+
+ return base( x, searchElement, fromIndex, out, opts );
+}
+
+
+// EXPORTS //
+
+module.exports = assign;
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/lib/base.js b/lib/node_modules/@stdlib/blas/ext/index-of/lib/base.js
new file mode 100644
index 000000000000..d229c661c1b8
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/lib/base.js
@@ -0,0 +1,120 @@
+/**
+* @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 gindexOf = require( '@stdlib/blas/ext/base/ndarray/gindex-of' );
+var dindexOf = require( '@stdlib/blas/ext/base/ndarray/dindex-of' );
+var sindexOf = require( '@stdlib/blas/ext/base/ndarray/sindex-of' );
+var factory = require( '@stdlib/ndarray/base/unary-reduce-strided1d-dispatch-factory' );
+
+
+// VARIABLES //
+
+var idtypes0 = dtypes( 'all' ); // input ndarray
+var idtypes1 = dtypes( 'all' ); // search element ndarray
+var idtypes2 = dtypes( 'integer_index_and_generic' ); // from index ndarray
+var odtypes = dtypes( 'integer_index_and_generic' );
+var policies = {
+ 'output': 'integer_index_and_generic',
+ 'casting': 'none'
+};
+var table = {
+ 'types': [
+ 'float64',
+ 'float32'
+
+ // FIXME: add specialized support for `cindexOf` and `zindexOf` once the corresponding packages are implemented
+ ],
+ 'fcns': [
+ dindexOf,
+ sindexOf
+ ],
+ 'default': gindexOf
+};
+
+
+// MAIN //
+
+/**
+* Returns the first index of a specified search element along one or more ndarray dimensions.
+*
+* @private
+* @name indexOf
+* @type {Function}
+* @param {ndarrayLike} x - input ndarray
+* @param {ndarrayLike} searchElement - search element
+* @param {ndarrayLike} fromIndex - indices from which to begin searching
+* @param {Options} [options] - function options
+* @param {IntegerArray} [options.dims] - list of dimensions over which to perform operation
+* @param {string} [options.dtype] - output ndarray data type
+* @throws {TypeError} first argument must be an ndarray-like object
+* @throws {TypeError} second argument must be either an ndarray-like object
+* @throws {TypeError} third argument must be either an ndarray-like object
+* @throws {TypeError} options argument must be an object
+* @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 scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+*
+* // Create a data buffer:
+* var xbuf = new Float64Array( [ 1.0, 2.0, -3.0, 4.0, -5.0, 6.0 ] );
+*
+* // Define the shape of the input array:
+* var sh = [ 3, 1, 2 ];
+*
+* // Define the array strides:
+* var sx = [ 2, 2, 1 ];
+*
+* // Define the index offset:
+* var ox = 0;
+*
+* // Create an input ndarray:
+* var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
+*
+* // Create a search element ndarray:
+* var searchElement = scalar2ndarray( 4.0, {
+* 'dtype': 'float64'
+* })
+*
+* // Create a from index ndarray:
+* var fromIndex = scalar2ndarray( 0, {
+* 'dtype': 'int32'
+* })
+*
+* // Find index:
+* var out = indexOf( x, searchElement, fromIndex );
+* // returns
+*
+* var idx = out.get();
+* // returns 3
+*/
+var indexOf = factory( table, [ idtypes0, idtypes1, idtypes2 ], odtypes, policies ); // eslint-disable-line max-len
+
+
+// EXPORTS //
+
+module.exports = indexOf;
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/lib/index.js b/lib/node_modules/@stdlib/blas/ext/index-of/lib/index.js
new file mode 100644
index 000000000000..bf6f62182e35
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/lib/index.js
@@ -0,0 +1,70 @@
+/**
+* @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';
+
+/**
+* Return the first index of a specified search element along one or more ndarray dimensions.
+*
+* @module @stdlib/blas/ext/index-of
+*
+* @example
+* var Float64Array = require( '@stdlib/array/float64' );
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+* var indexOf = require( '@stdlib/blas/ext/index-of' );
+*
+* // Create a data buffer:
+* var xbuf = new Float64Array( [ 1.0, 2.0, -3.0, 4.0, -5.0, 6.0 ] );
+*
+* // Define the shape of the input array:
+* var sh = [ 3, 1, 2 ];
+*
+* // Define the array strides:
+* var sx = [ 2, 2, 1 ];
+*
+* // Define the index offset:
+* var ox = 0;
+*
+* // Create an input ndarray:
+* var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
+*
+* // Find index:
+* var out = indexOf( x, 4.0 );
+* // returns
+*
+* var idx = out.get();
+* // returns 3
+*/
+
+// MODULES //
+
+var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
+var main = require( './main.js' );
+var assign = require( './assign.js' );
+
+
+// MAIN //
+
+setReadOnly( main, 'assign', assign );
+
+
+// EXPORTS //
+
+module.exports = main;
+
+// exports: { "assign": "main.assign" }
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/lib/main.js b/lib/node_modules/@stdlib/blas/ext/index-of/lib/main.js
new file mode 100644
index 000000000000..440ea88447cd
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/lib/main.js
@@ -0,0 +1,164 @@
+/**
+* @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 hasOwnProp = require( '@stdlib/assert/has-own-property' );
+var objectAssign = require( '@stdlib/object/assign' );
+var isObject = require( '@stdlib/assert/is-object' );
+var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
+var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var broadcastScalar = require( '@stdlib/ndarray/base/broadcast-scalar' );
+var maybeBroadcastArray = require( '@stdlib/ndarray/base/maybe-broadcast-array' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getOrder = require( '@stdlib/ndarray/order' );
+var format = require( '@stdlib/string/format' );
+var defaults = require( '@stdlib/ndarray/defaults' );
+var nonCoreShape = require( './non_core_shape.js' );
+var base = require( './base.js' );
+
+
+// VARIABLES //
+
+var DEFAULT_DTYPE = defaults.get( 'dtypes.integer_index' );
+
+
+// MAIN //
+
+/**
+* Returns the first index of a specified search element along one or more ndarray dimensions.
+*
+* @name indexOf
+* @type {Function}
+* @param {ndarrayLike} x - input ndarray
+* @param {(ndarrayLike|*)} searchElement - search element
+* @param {(ndarrayLike|integer)} [fromIndex] - index from which to begin searching
+* @param {Options} [options] - function options
+* @param {IntegerArray} [options.dims] - list of dimensions over which to perform operation
+* @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
+* @throws {TypeError} first argument must be an ndarray-like object
+* @throws {TypeError} the function must be provided at least two arguments
+* @throws {TypeError} third argument must be either an ndarray-like object or an integer
+* @throws {TypeError} options argument must be an object
+* @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( [ 1.0, 2.0, -3.0, 4.0, -5.0, 6.0 ] );
+*
+* // Define the shape of the input array:
+* var sh = [ 3, 1, 2 ];
+*
+* // Define the array strides:
+* var sx = [ 2, 2, 1 ];
+*
+* // Define the index offset:
+* var ox = 0;
+*
+* // Create an input ndarray:
+* var x = new ndarray( 'float64', xbuf, sh, sx, ox, 'row-major' );
+*
+* // Find index:
+* var out = indexOf( x, 4.0 );
+* // returns
+*
+* var idx = out.get();
+* // returns 3
+*/
+function indexOf( x, searchElement, fromIndex, options ) {
+ var nargs;
+ var opts;
+ var ord;
+ var dt;
+ var sh;
+
+ if ( !isndarrayLike( x ) ) {
+ throw new TypeError( format( 'invalid argument. The first argument must be an ndarray-like object. Value: `%s`.', x ) );
+ }
+
+ nargs = arguments.length;
+ if ( nargs < 2 ) {
+ throw new TypeError( format( 'invalid argument. The function must be provided at least two arguments. Value: `%s`.', nargs ) );
+ }
+
+ // Resolve input ndarray meta data:
+ dt = getDType( x );
+ ord = getOrder( x );
+
+ // Initialize options object:
+ opts = {};
+
+ // Case: indexOf( x, searchElement )
+ if ( nargs === 2 ) {
+ fromIndex = 0;
+ }
+ // Case: indexOf( x, searchElement, options )
+ else if (
+ nargs === 3 &&
+ !isndarrayLike( fromIndex ) &&
+ isObject( fromIndex )
+ ) {
+ opts = objectAssign( opts, fromIndex );
+ fromIndex = 0;
+ }
+ // Case: indexOf( x, searchElement, fromIndex, options )
+ else if ( nargs === 4 ) {
+ if ( !isObject( options ) ) {
+ throw new TypeError( format( 'invalid argument. The fourth argument must be an object. Value: `%s`.', options ) );
+ }
+ opts = objectAssign( opts, options );
+ }
+
+ // Resolve shape for broadcasting
+ if ( hasOwnProp( opts, 'dims' ) ) {
+ sh = nonCoreShape( getShape( x ), opts.dims );
+ } else {
+ sh = [];
+ }
+
+ if ( isndarrayLike( searchElement ) ) {
+ searchElement = maybeBroadcastArray( searchElement, sh );
+ } else {
+ searchElement = broadcastScalar( searchElement, dt, sh, ord );
+ }
+
+ if ( isndarrayLike( fromIndex ) ) {
+ fromIndex = maybeBroadcastArray( fromIndex, sh );
+ } else if ( isInteger( fromIndex ) ) {
+ fromIndex = broadcastScalar( fromIndex, DEFAULT_DTYPE, sh, ord );
+ } else {
+ throw new TypeError( format( 'invalid argument. Third argument must be either an ndarray or an integer. Value: `%s`.', fromIndex ) );
+ }
+
+ return base( x, searchElement, fromIndex, opts );
+}
+
+
+// EXPORTS //
+
+module.exports = indexOf;
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/lib/non_core_shape.js b/lib/node_modules/@stdlib/blas/ext/index-of/lib/non_core_shape.js
new file mode 100644
index 000000000000..07e99731e89f
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/lib/non_core_shape.js
@@ -0,0 +1,50 @@
+/**
+* @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 normalizeIndices = require( '@stdlib/ndarray/base/to-unique-normalized-indices' );
+var indicesComplement = require( '@stdlib/array/base/indices-complement' );
+var takeIndexed = require( '@stdlib/array/base/take-indexed' );
+
+
+// MAIN //
+
+/**
+* Returns the shape defined by the dimensions which are **not** included in a list of dimensions.
+*
+* @private
+* @param {NonNegativeIntegerArray} shape - input ndarray
+* @param {IntegerArray} dims - list of dimensions
+* @returns {NonNegativeIntegerArray} shape
+*/
+function nonCoreShape( shape, dims ) { // TODO: consider moving to a `@stdlib/ndarray/base` utility
+ var ind = normalizeIndices( dims, shape.length-1 );
+ if ( ind === null ) {
+ // Note: this is an error condition, as `null` is returned when provided out-of-bounds indices...
+ return [];
+ }
+ return takeIndexed( shape, indicesComplement( shape.length, ind ) );
+}
+
+
+// EXPORTS //
+
+module.exports = nonCoreShape;
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/package.json b/lib/node_modules/@stdlib/blas/ext/index-of/package.json
new file mode 100644
index 000000000000..ce741c897892
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/package.json
@@ -0,0 +1,67 @@
+{
+ "name": "@stdlib/blas/ext/index-of",
+ "version": "0.0.0",
+ "description": "Return the first index of a specified search element along one or more ndarray dimensions.",
+ "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",
+ "blas",
+ "find",
+ "index",
+ "search",
+ "element",
+ "array",
+ "ndarray",
+ "strided",
+ "double",
+ "float",
+ "float64",
+ "float64array"
+ ],
+ "__stdlib__": {}
+}
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/test/test.assign.js b/lib/node_modules/@stdlib/blas/ext/index-of/test/test.assign.js
new file mode 100644
index 000000000000..fd68b43201dc
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/test/test.assign.js
@@ -0,0 +1,1662 @@
+/**
+* @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 isSameArray = require( '@stdlib/assert/is-same-array' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getOrder = require( '@stdlib/ndarray/order' );
+var getData = require( '@stdlib/ndarray/data-buffer' );
+var indexOf = require( './../lib' ).assign;
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof indexOf, '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 (searchElement_scalar)', function test( t ) {
+ var values;
+ var i;
+ var y;
+
+ y = zeros( [], {
+ '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() {
+ indexOf( value, 2.0, y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray)', function test( t ) {
+ var values;
+ var i;
+ var y;
+
+ y = zeros( [], {
+ '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() {
+ indexOf( value, scalar2ndarray( 2.0 ), y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar)', function test( t ) {
+ var values;
+ var i;
+ var y;
+
+ y = zeros( [], {
+ '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() {
+ indexOf( value, 2.0, 0, y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+ var values;
+ var i;
+ var y;
+
+ y = zeros( [], {
+ '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() {
+ indexOf( value, scalar2ndarray( 2.0 ), 0, y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( value, 2.0, scalar2ndarray( 0, opts ), y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, opts ), y ); // eslint-disable-line max-len
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( value, 2.0, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( value, scalar2ndarray( 2.0 ), y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( value, 2.0, 0, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( value, scalar2ndarray( 2.0 ), 0, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( value, 2.0, scalar2ndarray( 0, opts ), y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray, options)', function test( t ) {
+ var values;
+ var opts;
+ var i;
+ var y;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, opts ), y, {} ); // eslint-disable-line max-len
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, integer or an object', function test( t ) {
+ var values;
+ var i;
+ var x;
+ var y;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+ values = [
+ '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() {
+ indexOf( x, scalar2ndarray( 2.0 ), value, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided insufficient number of arguments', function test( t ) {
+ var x;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ function badValue1() {
+ return function badValue() {
+ indexOf( x );
+ };
+ }
+
+ function badValue2() {
+ return function badValue() {
+ indexOf( x, 10.0 );
+ };
+ }
+
+ function badValue3() {
+ return function badValue() {
+ indexOf();
+ };
+ }
+
+ t.throws( badValue1(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.throws( badValue2(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.throws( badValue3(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a search element which is not broadcast-compatible', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ 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() {
+ indexOf( x, value, y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an search element which is not broadcast-compatible (options)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ 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() {
+ indexOf( x, value, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ 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() {
+ indexOf( x, scalar2ndarray( 0 ), value, y );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible (options)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ 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() {
+ indexOf( x, scalar2ndarray( 0 ), value, y, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ '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() {
+ indexOf( x, 10.0, y, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ values = [
+ '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() {
+ indexOf( x, scalar2ndarray( 10.0, opts ), y, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_scalar)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( x, 10.0, 0, y, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( x, scalar2ndarray( 10.0, opts ), scalar2ndarray( 0, opts ), y, value ); // eslint-disable-line max-len
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( x, 10.0, scalar2ndarray( 0, opts ), y, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( x, scalar2ndarray( 10.0, opts ), 0, y, 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 opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( x, 10.0, y, {
+ 'dims': value
+ });
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains out-of-bounds indices', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( x, 10.0, y, {
+ 'dims': value
+ });
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains too many indices', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( x, 10.0, y, {
+ 'dims': value
+ });
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a `dims` option which contains duplicate indices', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var y;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+ y = zeros( [], opts );
+
+ 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() {
+ indexOf( x, 10.0, y, {
+ 'dims': value
+ });
+ };
+ }
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ actual = indexOf( x, 2.0, y );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, y );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, y );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, y );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (all dimensions, row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ actual = indexOf( x, 2.0, y, {
+ 'dims': [ 0, 1 ]
+ });
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, y, {
+ 'dims': [ 0, 1 ]
+ });
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (all dimensions, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, y, {
+ 'dims': [ 0, 1 ]
+ });
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, y, {
+ 'dims': [ 0, 1 ]
+ });
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (no dimensions, row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ actual = indexOf( x, 2.0, y, {
+ 'dims': []
+ });
+ expected = [ [ -1, 0 ], [ -1, -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), getShape( x ), 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, y, {
+ 'dims': []
+ });
+ expected = [ [ -1, 0 ], [ -1, -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), getShape( x ), 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (no dimensions, column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2, 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, y, {
+ 'dims': []
+ });
+ expected = [ [ -1, -1 ], [ 0, -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), getShape( x ), 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, y, {
+ 'dims': []
+ });
+ expected = [ [ -1, -1 ], [ 0, -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), getShape( x ), 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying operation dimensions (row-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ actual = indexOf( x, 2.0, y, {
+ 'dims': [ 0 ]
+ });
+ expected = [ -1, 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, y, {
+ 'dims': [ 0 ]
+ });
+ expected = [ -1, 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ actual = indexOf( x, 2.0, y, {
+ 'dims': [ 1 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, y, {
+ 'dims': [ 1 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying operation dimensions (column-major)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, y, {
+ 'dims': [ 0 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, y, {
+ 'dims': [ 0 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, y, {
+ 'dims': [ 1 ]
+ });
+ expected = [ -1, 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, y, {
+ 'dims': [ 1 ]
+ });
+ expected = [ -1, 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ actual = indexOf( x, 2.0, 0, y );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, 0, y );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar, options)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ actual = indexOf( x, 2.0, 0, y, {} );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, 0, y, {} );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray)', function test( t ) {
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ });
+ actual = indexOf( x, 2.0, fromIdx, y );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, fromIdx, y );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray, options)', function test( t ) {
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [], {
+ 'dtype': 'generic'
+ });
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ });
+ actual = indexOf( x, 2.0, fromIdx, y, {} );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, fromIdx, y, {} );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar, broadcasted)', function test( t ) {
+ var expected;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ actual = indexOf( x, 2.0, 0, y, {
+ 'dims': [ 0 ]
+ });
+ expected = [ -1, 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, 0, y, {
+ 'dims': [ 0 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray, broadcasted)', function test( t ) {
+ var expected;
+ var fromIdx;
+ var actual;
+ var xbuf;
+ var x;
+ var y;
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 2, 1 ], 0, 'row-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic'
+ });
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'int32'
+ });
+ actual = indexOf( x, 2.0, fromIdx, y, {
+ 'dims': [ 0 ]
+ });
+ expected = [ -1, 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+ y = zeros( [ 2 ], {
+ 'dtype': 'generic',
+ 'order': 'column-major'
+ });
+
+ actual = indexOf( x, 2.0, fromIdx, y, {
+ 'dims': [ 0 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+ t.strictEqual( ( y === actual ), true, 'returns expected value' );
+
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/test/test.js b/lib/node_modules/@stdlib/blas/ext/index-of/test/test.js
new file mode 100644
index 000000000000..613d92b3d402
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/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 indexOf = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof indexOf, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'attached to the main export is an `assign` method', function test( t ) {
+ t.strictEqual( isMethod( indexOf, 'assign' ), true, 'returns expected value' );
+ t.end();
+});
diff --git a/lib/node_modules/@stdlib/blas/ext/index-of/test/test.main.js b/lib/node_modules/@stdlib/blas/ext/index-of/test/test.main.js
new file mode 100644
index 000000000000..797cc400860e
--- /dev/null
+++ b/lib/node_modules/@stdlib/blas/ext/index-of/test/test.main.js
@@ -0,0 +1,1472 @@
+/**
+* @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 isSameArray = require( '@stdlib/assert/is-same-array' );
+var isEqualInt32Array = require( '@stdlib/assert/is-equal-int32array' );
+var Int32Array = require( '@stdlib/array/int32' );
+var ndarray = require( '@stdlib/ndarray/ctor' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
+var getDType = require( '@stdlib/ndarray/dtype' );
+var getShape = require( '@stdlib/ndarray/shape' );
+var getOrder = require( '@stdlib/ndarray/order' );
+var getData = require( '@stdlib/ndarray/data-buffer' );
+var indexOf = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof indexOf, '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 (searchElement_scalar)', 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() {
+ indexOf( value, 2.0 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray)', 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() {
+ indexOf( value, scalar2ndarray( 2.0 ) );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar)', 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() {
+ indexOf( value, 2.0, 0 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar)', 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() {
+ indexOf( value, scalar2ndarray( 2.0 ), 0 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray)', 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() {
+ indexOf( value, 2.0, scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ }));
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray)', 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() {
+ indexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ }));
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, 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() {
+ indexOf( value, 2.0, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, 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() {
+ indexOf( value, scalar2ndarray( 2.0 ), {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_scalar, 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() {
+ indexOf( value, 2.0, 0, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_scalar, 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() {
+ indexOf( value, scalar2ndarray( 2.0 ), 0, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_scalar, fromIndex_ndarray, 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() {
+ indexOf( value, 2.0, scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ }), {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object (searchElement_ndarray, fromIndex_ndarray, 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() {
+ indexOf( value, scalar2ndarray( 2.0 ), scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ }), {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a third argument which is not an ndarray-like object, integer or an object', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+ values = [
+ '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() {
+ indexOf( x, scalar2ndarray( 2.0 ), value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided insufficient number of arguments', function test( t ) {
+ var x;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ function badValue1() {
+ return function badValue() {
+ indexOf( x );
+ };
+ }
+
+ function badValue2() {
+ return function badValue() {
+ indexOf();
+ };
+ }
+
+ t.throws( badValue1(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.throws( badValue2(), TypeError, 'throws an error when provided insufficient arguments' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a search element which is not broadcast-compatible', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ 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() {
+ indexOf( x, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an search element which is not broadcast-compatible (options)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ 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() {
+ indexOf( x, value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ 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() {
+ indexOf( x, scalar2ndarray( 0 ), value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a from index which is not broadcast-compatible (options)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ zeros( [ 4 ], opts ),
+ zeros( [ 2, 2, 2 ], opts ),
+ zeros( [ 0 ], opts )
+ ];
+ 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() {
+ indexOf( x, scalar2ndarray( 0 ), value, {} );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar)', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'generic'
+ });
+
+ values = [
+ '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() {
+ indexOf( x, 10.0, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ values = [
+ '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() {
+ indexOf( x, scalar2ndarray( 10.0, opts ), value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_scalar)', 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() {
+ indexOf( x, 10.0, 0, value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+ x = zeros( [ 2, 2 ], opts );
+
+ 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() {
+ indexOf( x, scalar2ndarray( 10.0, opts ), scalar2ndarray( 0, opts ), value ); // eslint-disable-line max-len
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_scalar, fromIndex_ndarray)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+
+ 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() {
+ indexOf( x, 10.0, scalar2ndarray( 0, opts ), value );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided an options argument which is not an object (searchElement_ndarray, fromIndex_scalar)', function test( t ) {
+ var values;
+ var opts;
+ var x;
+ var i;
+
+ opts = {
+ 'dtype': 'generic'
+ };
+
+ x = zeros( [ 2, 2 ], opts );
+
+ 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() {
+ indexOf( x, scalar2ndarray( 10.0, opts ), 0, 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 = [
+ 'bool',
+ 'float64',
+ 'float32',
+ '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() {
+ indexOf( x, 10.0, {
+ 'dtype': 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 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() {
+ indexOf( x, 10.0, {
+ 'dims': value
+ });
+ };
+ }
+});
+
+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() {
+ indexOf( x, 10.0, {
+ 'dims': value
+ });
+ };
+ }
+});
+
+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() {
+ indexOf( x, 10.0, {
+ 'dims': value
+ });
+ };
+ }
+});
+
+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() {
+ indexOf( x, 10.0, {
+ 'dims': value
+ });
+ };
+ }
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (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 = indexOf( x, 2.0 );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0 );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (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 = indexOf( x, 2.0 );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0 );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (all dimensions, 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 = indexOf( x, 2.0, {
+ 'dims': [ 0, 1 ]
+ });
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, {
+ 'dims': [ 0, 1 ]
+ });
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (all dimensions, 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 = indexOf( x, 2.0, {
+ 'dims': [ 0, 1 ]
+ });
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, {
+ 'dims': [ 0, 1 ]
+ });
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns the first index of a specified search element in an ndarray (no dimensions, 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 = indexOf( x, 2.0, {
+ 'dims': []
+ });
+ expected = [ [ -1, 0 ], [ -1, -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), getShape( x ), 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, {
+ 'dims': []
+ });
+ expected = [ [ -1, 0 ], [ -1, -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), getShape( x ), '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 returns the first index of a specified search element in an ndarray (no dimensions, 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 = indexOf( x, 2.0, {
+ 'dims': []
+ });
+ expected = [ [ -1, -1 ], [ 0, -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), getShape( x ), 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
+
+ actual = indexOf( x, 2.0, 0, {
+ 'dims': []
+ });
+ expected = [ [ -1, -1 ], [ 0, -1 ] ];
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'generic', 'returns expected value' );
+ t.deepEqual( getShape( actual ), getShape( x ), '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 operation dimensions (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 = indexOf( x, 2.0, {
+ 'dims': [ 0 ]
+ });
+ expected = [ -1, 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' );
+
+ actual = indexOf( x, 2.0, 0, {
+ 'dims': [ 0 ]
+ });
+ expected = [ -1, 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' );
+
+ actual = indexOf( x, 2.0, {
+ 'dims': [ 1 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+
+ actual = indexOf( x, 2.0, 0, {
+ 'dims': [ 1 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying operation dimensions (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 = indexOf( x, 2.0, {
+ 'dims': [ 0 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+
+ actual = indexOf( x, 2.0, 0, {
+ 'dims': [ 0 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+
+ actual = indexOf( x, 2.0, {
+ 'dims': [ 1 ]
+ });
+ expected = [ -1, 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' );
+
+ actual = indexOf( x, 2.0, 0, {
+ 'dims': [ 1 ]
+ });
+ expected = [ -1, 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' );
+
+ t.end();
+});
+
+tape( 'the function supports specifying the output array data type', 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 = indexOf( x, 2.0, {
+ 'dtype': 'int32'
+ });
+ expected = new Int32Array( [ 1 ] );
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'int32', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( isEqualInt32Array( getData( actual ), expected ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = indexOf( x, 2.0, 0, {
+ 'dtype': 'int32'
+ });
+ expected = new Int32Array( [ 1 ] );
+
+ t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
+ t.strictEqual( getDType( actual ), 'int32', 'returns expected value' );
+ t.deepEqual( getShape( actual ), [], 'returns expected value' );
+ t.strictEqual( getOrder( actual ), getOrder( x ), 'returns expected value' );
+ t.strictEqual( isEqualInt32Array( getData( actual ), expected ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar)', 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 = indexOf( x, 2.0, 0 );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = indexOf( x, 2.0, 0 );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar, options)', 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 = indexOf( x, 2.0, 0, {} );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = indexOf( x, 2.0, 0, {} );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray)', function test( t ) {
+ var expected;
+ var fromIdx;
+ 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' );
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ });
+ actual = indexOf( x, 2.0, fromIdx );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = indexOf( x, 2.0, fromIdx );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray, options)', function test( t ) {
+ var expected;
+ var fromIdx;
+ 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' );
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'generic'
+ });
+ actual = indexOf( x, 2.0, fromIdx, {} );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ xbuf = [ -1.0, 2.0, -3.0, 4.0 ];
+ x = new ndarray( 'generic', xbuf, [ 2, 2 ], [ 1, 2 ], 0, 'column-major' );
+
+ actual = indexOf( x, 2.0, fromIdx, {} );
+ expected = [ 1 ];
+
+ 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( isSameArray( getData( actual ), expected ), true, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (scalar, broadcasted)', 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 = indexOf( x, 2.0, 0, {
+ 'dims': [ 0 ]
+ });
+ expected = [ -1, 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' );
+
+ actual = indexOf( x, 2.0, 0, {
+ 'dims': [ 0 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+
+ t.end();
+});
+
+tape( 'the function supports providing a from index (0d ndarray, broadcasted)', function test( t ) {
+ var expected;
+ var fromIdx;
+ 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' );
+
+ fromIdx = scalar2ndarray( 0, {
+ 'dtype': 'int32'
+ });
+ actual = indexOf( x, 2.0, fromIdx, {
+ 'dims': [ 0 ]
+ });
+ expected = [ -1, 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' );
+
+ actual = indexOf( x, 2.0, fromIdx, {
+ 'dims': [ 0 ]
+ });
+ expected = [ 1, -1 ];
+
+ 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' );
+
+ t.end();
+});