diff --git a/lib/node_modules/@stdlib/array/base/with/README.md b/lib/node_modules/@stdlib/array/base/with/README.md
new file mode 100644
index 000000000000..73d360ad55d7
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/base/with/README.md
@@ -0,0 +1,151 @@
+
+
+# withArray
+
+> Return a new array after replacing an index with a given value.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var withArray = require( '@stdlib/array/base/with' );
+```
+
+#### withArray( x, index, value )
+
+Return a new array after updating an index into the input array.
+
+```javascript
+var x = [ 1, 2, 3, 4 ];
+
+var out = withArray( x, 0, 5 );
+// returns [5, 2, 3, 4]
+
+out = withArray( x, -1, 6 );
+// returns [1, 2, 3, 6]
+
+```
+
+The function accepts the following arguments:
+
+- **x**: an input array.
+- **index**: element index.
+- **value**: replacement value.
+
+
+
+
+
+
+
+
+
+## Notes
+
+- If provided an array-like object having a `with` method, the function defers execution to that method and assumes that the method has the following signature:
+
+ ```text
+ x.with( index, value )
+ ```
+
+ If provided an array-like object without a `with` method, the function manually shallow copied that object and assign provided value to that index.
+
+- Negative indices are resolved relative to the last array element, with the last element corresponding to `-1`.
+
+- If provided out-of-bounds indices, the function always returns `undefined`.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var discreteuniform = require( '@stdlib/random/array/discrete-uniform' );
+var withArray = require( '@stdlib/array/base/with' );
+var rand = require( '@stdlib/random/base/randu' );
+var x;
+var indices;
+
+// Define an array:
+x = discreteuniform( 10, -100, 100 );
+
+// Define an array containing random index values:
+indices = discreteuniform( 100, -x.length, x.length-1 );
+
+// Randomly selected values from the input array:
+var i;
+var index;
+var newvalue;
+var updatedarray;
+for (i = 0; i < indices.length; i++) {
+ index = indices[i];
+ newvalue = rand(); // Random value between -100 and 100
+ updatedarray = withArray(x, index, newvalue); // Update the value at the given index
+ console.log('Updated x[%d] to %d', index, newvalue);
+ console.log('Updated array:', updatedarray);
+}
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/array/base/with/benchmark/benchmark.js b/lib/node_modules/@stdlib/array/base/with/benchmark/benchmark.js
new file mode 100755
index 000000000000..f32070ca5c89
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/base/with/benchmark/benchmark.js
@@ -0,0 +1,51 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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 withArray = require( '@stdlib/array/base/with/lib' );
+var uniform = require( '@stdlib/random/array/uniform' );
+var bench = require( '@stdlib/bench' );
+var rand = require( '@stdlib/random/base/randu' );
+var pkg = require( '@stdlib/array/base/with/package.json' ).name;
+
+
+// MAIN //
+
+bench( pkg, function benchmark( b ) {
+ var value;
+ var x;
+ var v;
+ var i;
+ var j;
+
+ x = uniform( 100, 0.0, 10.0 );
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ j = ( i%20 );
+ value = rand();
+ v = withArray( x, j, value );
+ b.equal(v[j], value, 'index ' + j + ' should be updated to ' + value);
+ }
+ b.toc();
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/array/base/with/docs/repl.txt b/lib/node_modules/@stdlib/array/base/with/docs/repl.txt
new file mode 100644
index 000000000000..32da2ed818ef
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/base/with/docs/repl.txt
@@ -0,0 +1,30 @@
+
+{{alias}}( x, index, value )
+ Return a new array after replacing an index with a given value.
+
+ Parameters
+ ----------
+ x: ArrayLikeObject
+ Input array.
+
+ index: integer
+ Index of the element to be replaced.
+
+ value: any
+ Value to replace the element at the specified index with.
+
+ Returns
+ -------
+ out: ArrayLikeObject
+ Updated array.
+
+ Examples
+ --------
+ > var x = [ 1, 2, 3, 4 ];
+ > {{alias}}( x, 0, 5 )
+ [ 5, 2, 3, 4 ]
+ > {{alias}}( x, -1, 6 )
+ [ 1, 2, 3, 6 ]
+
+ See Also
+ --------
diff --git a/lib/node_modules/@stdlib/array/base/with/docs/types/index.d.ts b/lib/node_modules/@stdlib/array/base/with/docs/types/index.d.ts
new file mode 100755
index 000000000000..4149c5106f0a
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/base/with/docs/types/index.d.ts
@@ -0,0 +1,91 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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 { Collection, AccessorArrayLike, Complex128Array, Complex64Array } from '@stdlib/types/array';
+
+/**
+* Returns a new array after updating an index into the input array.
+*
+* If provided an array-like object having a `with` method , the function defers
+* execution to that method and assumes that the method has the following
+* signature:
+*
+* x.with( index, value )
+*
+* If provided an array-like object without a `with` method, the function manually
+* shallow copied that object and assign provided value to that index.
+*
+* Negative indices are resolved relative to the last array element, with the last
+* element corresponding to `-1`.
+*
+* If provided out-of-bounds indices, the function always returns `undefined`.
+*
+* @param x - input array
+* @param index - element index
+* @param value - replacement value
+* @returns updated array
+*
+* @example
+* var x = [ 1, 2, 3, 4 ];
+* var out = with( x, 0, 5 );
+* // returns [ 5, 2, 3, 4 ]
+
+* @example
+* var out = with( x, -1, 6 );
+* // returns [ 1, 2, 3, 6 ]
+*/
+
+/**
+ * Sets the value at the specified index in a Complex128Array.
+ *
+ * @param x - Complex128Array to modify
+ * @param index - index at which to set the value
+ * @param value - new value to set
+ * @returns modified Complex128Array if successful; otherwise, throws a range error.
+ */
+declare function withArray( x: Complex128Array, index: number, value: any ): Complex128Array | void;
+
+/**
+ * Sets the value at the specified index in a Complex64Array.
+ *
+ * @param x - Complex64Array to modify
+ * @param index - index at which to set the value
+ * @param value - new value to set
+ * @returns modified Complex64Array if successful; otherwise, throws a range error
+ */
+declare function withArray( x: Complex64Array, index: number, value: any ): Complex64Array | void;
+
+/**
+ * Sets the value at the specified index in an array and returns the modified array.
+ *
+ * @template T - type of elements in the array
+ * @param x - array to modify, which can be either a Collection or an AccessorArrayLike
+ * @param index - index at which to set the value
+ * @param value - new value to set
+ * @returns modified array if successful; otherwise, throws range error
+ */
+declare function withArray< T = unknown >( x: Collection | AccessorArrayLike, index: number, value: any ): Collection | AccessorArrayLike | void;
+
+
+// EXPORTS //
+
+export = withArray;
diff --git a/lib/node_modules/@stdlib/array/base/with/docs/types/test.ts b/lib/node_modules/@stdlib/array/base/with/docs/types/test.ts
new file mode 100755
index 000000000000..c125e299d264
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/base/with/docs/types/test.ts
@@ -0,0 +1,68 @@
+/*
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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.
+*/
+
+import Complex128Array = require( '@stdlib/array/complex128' );
+import Complex64Array = require( '@stdlib/array/complex64' );
+import toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
+import withArray = require( './index' );
+
+
+// TESTS //
+
+// The function returns an updated array...
+{
+ withArray( [ 1, 2, 3, 4 ], 0, 5 ); // $ExpectType void | Collection | AccessorArrayLike
+ withArray( new Complex128Array( 5 ), 0, { 're': 1.0, 'im': 1.0 } ); // $ExpectType void | Complex128Array
+ withArray( new Complex64Array( 5 ), 0, { 're': 1.0, 'im': 1.0 } ); // $ExpectType void | Complex64Array
+ withArray( toAccessorArray( [ 1, 2, 3, 4 ] ), 0, 5 ); // $ExpectType void | Collection | AccessorArrayLike
+}
+
+// The compiler throws an error if the function is provided a first argument which is not a collection...
+{
+ withArray( 5, 0, 5 ); // $ExpectError
+ withArray( true, 0, 5 ); // $ExpectError
+ withArray( false, 0, 5 ); // $ExpectError
+ withArray( null, 0, 5 ); // $ExpectError
+ withArray( void 0, 0, 5 ); // $ExpectError
+ withArray( {}, 0, 5 ); // $ExpectError
+ withArray( ( x: number ): number => x, 0, 5 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a second argument which is not a number...
+{
+ const x = [ 1, 2, 3, 4 ];
+
+ withArray( x, 'abc', 5 ); // $ExpectError
+ withArray( x, true, 5 ); // $ExpectError
+ withArray( x, false, 5 ); // $ExpectError
+ withArray( x, null, 5 ); // $ExpectError
+ withArray( x, void 0, 5 ); // $ExpectError
+ withArray( x, [ '1' ], 5 ); // $ExpectError
+ withArray( x, {}, 5 ); // $ExpectError
+ withArray( x, ( x: number ): number => x, 5 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const x = [ 1, 2, 3, 4 ];
+
+ withArray(); // $ExpectError
+ withArray( x ); // $ExpectError
+ withArray( x, 0 ); // $ExpectError
+ withArray( x, 0, 0, 5 ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/array/base/with/examples/index.js b/lib/node_modules/@stdlib/array/base/with/examples/index.js
new file mode 100755
index 000000000000..6457e36ba62d
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/base/with/examples/index.js
@@ -0,0 +1,45 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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 rand = require( '@stdlib/random/base/randu' );
+var withArray = require( './../lib' );
+var indices;
+var x;
+var i;
+
+// Define an array:
+x = discreteUniform( 10, -100, 100 );
+
+// Define an array containing random index values:
+indices = discreteUniform( 100, -x.length, x.length-1 );
+
+// Randomly selected values from the input array:
+var index;
+var newValue;
+var updatedArray;
+for ( i = 0; i < indices.length; i++ ) {
+ index = indices[i];
+ newValue = rand(); // Random value between -100 and 100
+
+ updatedArray = withArray(x, index, newValue); // Update the value at the random index
+ console.log('Updated x[%d] to %d', index, newValue);
+ console.log('Updated array:', updatedArray);
+}
diff --git a/lib/node_modules/@stdlib/array/base/with/lib/index.js b/lib/node_modules/@stdlib/array/base/with/lib/index.js
new file mode 100755
index 000000000000..e8476844c211
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/base/with/lib/index.js
@@ -0,0 +1,45 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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 an updated array after replacing an index with a given value.
+*
+* @module @stdlib/array/base/with
+*
+* @example
+* var withArray = require( '@stdlib/array/base/with' );
+*
+* var x = [ 1, 2, 3, 4 ];
+*
+* var v = withArray( x, 0 ,5 );
+* // returns [ 5, 2, 3, 4 ]
+*
+* v = withArray( x, -2, -1 );
+* // returns [ 1, 2, -1, 4 ]
+*/
+
+// MODULES //
+
+var main = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = main;
diff --git a/lib/node_modules/@stdlib/array/base/with/lib/main.js b/lib/node_modules/@stdlib/array/base/with/lib/main.js
new file mode 100755
index 000000000000..a0342f8e5ae7
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/base/with/lib/main.js
@@ -0,0 +1,106 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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 resolveGetter = require( '@stdlib/array/base/resolve-getter' );
+
+
+// FUNCTIONS //
+
+/**
+* Tests whether an object has a specified method.
+*
+* @private
+* @param {Object} obj - input object
+* @param {string} method - method name
+* @returns {boolean} boolean indicating whether an object has a specified method
+*
+* @example
+* var bool = hasMethod( [], 'map' );
+* // returns true
+*
+* @example
+* var bool = hasMethod( [], 'beep' );
+* // returns false
+*/
+function hasMethod( obj, method ) {
+ return ( typeof obj[ method ] === 'function' );
+}
+
+
+// MAIN //
+
+/**
+* Returns a new array after replacing an index with a given value.
+*
+* @param {Collection} x - input array
+* @param {integer} index - element index
+* @param {any} value - value assigned to that particular index
+* @throws {RangeError} if the index is out of bounds
+* @returns {Collection} modified array
+*
+* @example
+* var x = [ 1, 2, 3, 4 ];
+*
+* var v = withArray( x, 0 ,5 );
+* // returns [ 5, 2, 3, 4 ]
+*
+* v = withArray( x, 1 , 6 );
+* // returns [ 1, 6, 3, 4 ]
+*
+* v = withArray(x, -2 , 7);
+* // returns [ 1, 2, 7, 4 ]
+*/
+function withArray( x, index, value ) {
+ var modifiedArray= [];
+ var temp;
+ var get;
+ var k;
+
+ if ( index < 0 ) {
+ index += x.length;
+ }
+
+ if ( index < 0 || index >= x.length ) {
+ throw new RangeError( 'Index out of bounds' );
+ }
+
+ if ( hasMethod( x, 'with' ) ) {
+ return x.with( index, value );
+ }
+
+ for ( k = 0; k < x.length; k++ ) {
+ if ( k === index ) {
+ modifiedArray.push( value );
+ }
+ else {
+ get= resolveGetter( x );
+ temp = get( x, k );
+ modifiedArray.push( temp );
+ }
+ }
+ return modifiedArray;
+}
+
+
+// EXPORTS //
+
+module.exports = withArray;
diff --git a/lib/node_modules/@stdlib/array/base/with/package.json b/lib/node_modules/@stdlib/array/base/with/package.json
new file mode 100755
index 000000000000..1b624221bd14
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/base/with/package.json
@@ -0,0 +1,66 @@
+{
+ "name": "@stdlib/array/base/with",
+ "version": "0.0.0",
+ "description": "Return a new array after replacing an index with a given value.",
+ "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",
+ "base",
+ "array",
+ "typed",
+ "collection",
+ "vector",
+ "with",
+ "get",
+ "getter",
+ "accessor",
+ "access",
+ "retrieve"
+ ],
+ "__stdlib__": {}
+ }
\ No newline at end of file
diff --git a/lib/node_modules/@stdlib/array/base/with/test/test.js b/lib/node_modules/@stdlib/array/base/with/test/test.js
new file mode 100755
index 000000000000..f984fb8c8137
--- /dev/null
+++ b/lib/node_modules/@stdlib/array/base/with/test/test.js
@@ -0,0 +1,173 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 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 Int32Array = require( '@stdlib/array/int32' );
+var Complex128Array = require( '@stdlib/array/complex128' );
+var toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
+var Complex128 = require( '@stdlib/complex/float64' );
+var withArray = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof withArray, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function returns a new array with the specified index modified to the provided value (generic)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+
+ x = [ 1, 2, 3, 4, 5, 6 ];
+
+ expected = [ 1, 2, 3, 4, 10, 6 ];
+ actual = withArray( x, -2, 10 );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ t.notEqual( x, actual, 'returns a new array' );
+ t.end();
+});
+
+tape('the function throws a RangeError if provided an out-of-bounds index (generic)', function test( t ) {
+ var actual;
+ var x;
+
+ x = [ 1, 2, 3, 4, 5, 6 ];
+
+ actual = function outofbounds() {
+ withArray( x, 10, 10 );
+ };
+ t.throws( actual, RangeError, 'throws RangeError for positive out-of-bounds index' );
+
+ actual = function outofbounds() {
+ withArray( x, -10, 10 );
+ };
+ t.throws( actual, RangeError, 'throws RangeError for negative out-of-bounds index' );
+
+ t.end();
+});
+
+tape( 'the function returns a new array with the specified index modified to the provided value (typed array)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+
+ x = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] );
+
+ expected = new Int32Array( [ 1, 2, 10, 4, 5, 6 ] );
+ actual = withArray( x, 2, 10 );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ // // Ensure input array is not mutated:
+ t.notEqual( x, actual, 'returns a new array' );
+
+ t.end();
+});
+
+tape('the function throws a RangeError if provided an out-of-bounds index (typed array)', function test( t ) {
+ var actual;
+ var x = new Int32Array( [ 1, 2, 3, 4, 5, 6 ] );
+
+ actual = function outofbounds() {
+ withArray( x, 10, 10 );
+ };
+ t.throws( actual, RangeError, 'throws RangeError for positive out-of-bounds index' );
+
+ actual = function outofbounds() {
+ withArray( x, -10, 10 );
+ };
+ t.throws( actual, RangeError, 'throws RangeError for negative out-of-bounds index' );
+
+ t.end();
+});
+
+tape( 'the function returns a new array with the specified index modified to the provided value (complex typed array)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+
+ x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
+
+ expected = new Complex128Array([ 1.0, 2.0, 10.0, 4.0, 5.0, 6.0, 7.0, 8.0 ]);
+ actual = withArray( x, 2, new Complex128( 10.0, 0.0 ) );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ // Ensure input array is not mutated:
+ t.notEqual( x, actual, 'returns a new array' );
+
+ t.end();
+});
+
+tape('the function throws a RangeError if provided an out-of-bounds index (complex typed array)', function test( t ) {
+ var actual;
+ var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ] );
+
+ actual = function outofbounds() {
+ withArray( x, 10, new Complex128( 10.0, 0.0 ) );
+ };
+ t.throws( actual, RangeError, 'throws RangeError for positive out-of-bounds index' );
+
+ actual = function outofbounds() {
+ withArray( x, -10, new Complex128( 10.0, 0.0 ) );
+ };
+ t.throws( actual, RangeError, 'throws RangeError for negative out-of-bounds index' );
+
+ t.end();
+});
+
+tape( 'the function returns a new array with the specified index modified to the provided value (accessors)', function test( t ) {
+ var expected;
+ var actual;
+ var x;
+
+ x = toAccessorArray( [ 1, 2, 3, 4, 5, 6 ] );
+
+ expected = [ 1, 2, 10, 4, 5, 6 ];
+ actual = withArray( x, 2, 10 );
+ t.deepEqual( actual, expected, 'returns expected value' );
+
+ // Ensure input array is not mutated:
+ t.notEqual( toAccessorArray(x), actual, 'returns a new array' );
+
+ t.end();
+});
+
+tape('the function throws a RangeError if provided an out-of-bounds index (accessors)', function test(t) {
+ var actual;
+ var x = toAccessorArray([ 1, 2, 3, 4, 5, 6 ]);
+
+ actual = function outofbounds() {
+ withArray( x, 10, 10 );
+ };
+ t.throws( actual, RangeError, 'throws RangeError for positive out-of-bounds index' );
+
+ actual = function outofbounds() {
+ withArray( x, -10, 10 );
+ };
+ t.throws( actual, RangeError, 'throws RangeError for negative out-of-bounds index' );
+
+ t.end();
+});