diff --git a/lib/node_modules/@stdlib/ndarray/with/README.md b/lib/node_modules/@stdlib/ndarray/with/README.md
new file mode 100644
index 000000000000..323d75611679
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/with/README.md
@@ -0,0 +1,137 @@
+
+
+# ndarrayWith
+
+> Return a new [ndarray][@stdlib/ndarray/ctor] with the element at a specified index replaced by a provided value.
+
+
+
+
+
+
+
+
+
+
+
+## Usage
+
+```javascript
+var ndarrayWith = require( '@stdlib/ndarray/with' );
+```
+
+#### ndarrayWith( x, indices, value )
+
+Returns a new [ndarray][@stdlib/ndarray/ctor] with the element at a specified index replaced by a provided value.
+
+```javascript
+var zeros = require( '@stdlib/ndarray/zeros' );
+
+var x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+});
+// returns
+
+var out = ndarrayWith( x, [ 0, 0 ], 1.0 );
+// returns
+
+var v = out.get( 0, 0 );
+// returns 1.0
+```
+
+The function accepts the following arguments:
+
+- **x**: input [ndarray][@stdlib/ndarray/ctor].
+- **indices**: indices of the element to replace.
+- **value**: replacement value.
+
+
+
+
+
+
+
+
+
+## Notes
+
+- This function does not validate that a provided `value` is compatible with the data type of the input [ndarray][@stdlib/ndarray/ctor]. For example, the function does not guard against precision loss when `value` is a real-valued number and the input [ndarray][@stdlib/ndarray/ctor] has an integer data type. This function should be considered a copy-on-write analog to using an [ndarray][@stdlib/ndarray/ctor]'s `set` method. Whether a `value` is silently coerced to the data type of the input [ndarray][@stdlib/ndarray/ctor] or triggers an exception when incompatible is implementation-dependent. Accordingly, any assertion logic ensuring data type compatibility should be performed **before** calling this function.
+
+
+
+
+
+
+
+
+
+## Examples
+
+
+
+```javascript
+var zeros = require( '@stdlib/ndarray/zeros' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var ndarrayWith = require( '@stdlib/ndarray/with' );
+
+var x = zeros( [ 1, 3, 3 ], {
+ 'dtype': 'float64'
+});
+
+var out = ndarrayWith( x, [ 0, 1, 1 ], 10.0 );
+console.log( ndarray2array( out ) );
+```
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[@stdlib/ndarray/ctor]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/ctor
+
+
+
+
+
+
+
+
diff --git a/lib/node_modules/@stdlib/ndarray/with/benchmark/benchmark.js b/lib/node_modules/@stdlib/ndarray/with/benchmark/benchmark.js
new file mode 100644
index 000000000000..f032ebc0cea8
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/with/benchmark/benchmark.js
@@ -0,0 +1,150 @@
+/**
+* @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 isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var zeros = require( '@stdlib/ndarray/zeros' );
+var pkg = require( './../package.json' ).name;
+var ndarrayWith = require( './../lib' );
+
+
+// MAIN //
+
+bench( pkg+':ndims=1', function benchmark( b ) {
+ var v;
+ var x;
+ var i;
+
+ x = zeros( [ 5 ], {
+ 'dtype': 'float64'
+ });
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = ndarrayWith( x, [ 4 ], 5 );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+':ndims=2', function benchmark( b ) {
+ var v;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = ndarrayWith( x, [ 1, 1 ], 5 );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+':ndims=3', function benchmark( b ) {
+ var v;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = ndarrayWith( x, [ 1, 1, 1 ], 5 );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+':ndims=4', function benchmark( b ) {
+ var v;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2, 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = ndarrayWith( x, [ 1, 1, 1, 1 ], 5 );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
+bench( pkg+':ndims=5', function benchmark( b ) {
+ var v;
+ var x;
+ var i;
+
+ x = zeros( [ 2, 2, 2, 2, 2 ], {
+ 'dtype': 'float64'
+ });
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ v = ndarrayWith( x, [ 1, 1, 1, 1, 1 ], 5 );
+ if ( typeof v !== 'object' ) {
+ b.fail( 'should return an ndarray' );
+ }
+ }
+ b.toc();
+ if ( !isndarrayLike( v ) ) {
+ b.fail( 'should return an ndarray' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
diff --git a/lib/node_modules/@stdlib/ndarray/with/docs/repl.txt b/lib/node_modules/@stdlib/ndarray/with/docs/repl.txt
new file mode 100644
index 000000000000..b150afdae620
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/with/docs/repl.txt
@@ -0,0 +1,30 @@
+
+{{alias}}( x, indices, value )
+ Returns a new ndarray with the element at a specified index replaced by a
+ provided value.
+
+ Parameters
+ ----------
+ x: ndarray
+ Input array.
+
+ indices: Array
+ Indices of the value to replace.
+
+ value: any
+ Replaced value.
+
+ Returns
+ -------
+ out: ndarray
+ Output ndarray.
+
+ Examples
+ --------
+ > var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2 ], [ 3, 4 ] ] );
+ > var out = {{alias}}( x, [ 0, 0 ], 5 );
+ > var v = out.get( 0, 0 )
+ 5
+
+ See Also
+ --------
diff --git a/lib/node_modules/@stdlib/ndarray/with/docs/types/index.d.ts b/lib/node_modules/@stdlib/ndarray/with/docs/types/index.d.ts
new file mode 100644
index 000000000000..dbb5485f685c
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/with/docs/types/index.d.ts
@@ -0,0 +1,55 @@
+/*
+* @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 { typedndarray } from '@stdlib/types/ndarray';
+
+/**
+* Returns a new ndarray with the element at a specified index replaced by a provided value.
+*
+* @param x - input ndarray
+* @param indices - indices of the element to replace
+* @param value - value to set
+* @returns output ndarray
+*
+* @example
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+*
+* var buffer = [ 1, 2, 3, 4 ];
+* var shape = [ 2, 2 ];
+* var order = 'row-major';
+* var strides = [ 2, 1 ];
+* var offset = 0;
+*
+* var x = ndarray( 'generic', buffer, shape, strides, offset, order );
+*
+* var out = ndarrayWith( x, [ 0, 0 ], 5 );
+* // returns
+*
+* var v = out.get( 0, 0 );
+* // returns 5
+*/
+declare function ndarrayWith = typedndarray>( x: typedndarray, indices: Array, value: T ): U;
+
+
+// EXPORTS //
+
+export = ndarrayWith;
diff --git a/lib/node_modules/@stdlib/ndarray/with/docs/types/test.ts b/lib/node_modules/@stdlib/ndarray/with/docs/types/test.ts
new file mode 100644
index 000000000000..e3b134a2bbc7
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/with/docs/types/test.ts
@@ -0,0 +1,63 @@
+/*
+* @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.
+*/
+
+import array = require( '@stdlib/ndarray/array' );
+import ndarrayWith = require( './index' );
+
+
+// TESTS //
+
+// The function returns an ndarray...
+{
+ ndarrayWith( array( [ [ 1, 2 ], [ 3, 4 ] ] ), [ 0, 0 ], 5 ); // $ExpectType typedndarray
+}
+
+// The compiler throws an error if the function is provided a first argument which is not an ndarray...
+{
+ ndarrayWith( 123, [ 0, 0 ], 5 ); // $ExpectError
+ ndarrayWith( true, [ 0, 0 ], 5 ); // $ExpectError
+ ndarrayWith( false, [ 0, 0 ], 5 ); // $ExpectError
+ ndarrayWith( null, [ 0, 0 ], 5 ); // $ExpectError
+ ndarrayWith( undefined, [ 0, 0 ], 5 ); // $ExpectError
+ ndarrayWith( [ 1, 2 ], [ 0, 0 ], 5 ); // $ExpectError
+ ndarrayWith( {}, [ 0, 0 ], 5 ); // $ExpectError
+ ndarrayWith( ( x: number ): number => x, [ 0, 0 ], 5 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided a second argument which is not an array of integers...
+{
+ var x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+
+ ndarrayWith( x, [ '1' ], 5 );
+ ndarrayWith( x, 1, 5 ); // $ExpectError
+ ndarrayWith( x, true, 5 ); // $ExpectError
+ ndarrayWith( x, false, 5 ); // $ExpectError
+ ndarrayWith( x, null, 5 ); // $ExpectError
+ ndarrayWith( x, undefined, 5 ); // $ExpectError
+ ndarrayWith( x, {}, 5 ); // $ExpectError
+ ndarrayWith( x, ( y: number ): number => y, 5 ); // $ExpectError
+}
+
+// The compiler throws an error if the function is provided an unsupported number of arguments...
+{
+ const x = array( [ [ 1, 2 ], [ 3, 4 ] ] );
+
+ ndarrayWith(); // $ExpectError
+ ndarrayWith( x, [ 0, 0 ] ); // $ExpectError
+ ndarrayWith( x, [ 0, 0 ], 5, {} ); // $ExpectError
+}
diff --git a/lib/node_modules/@stdlib/ndarray/with/examples/index.js b/lib/node_modules/@stdlib/ndarray/with/examples/index.js
new file mode 100644
index 000000000000..49274cddef6b
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/with/examples/index.js
@@ -0,0 +1,30 @@
+/**
+* @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 zeros = require( '@stdlib/ndarray/zeros' );
+var ndarray2array = require( '@stdlib/ndarray/to-array' );
+var ndarrayWith = require( './../lib' );
+
+var x = zeros( [ 1, 3, 3 ], {
+ 'dtype': 'float64'
+});
+
+var out = ndarrayWith( x, [ 0, 1, 1 ], 10.0 );
+console.log( ndarray2array( out ) );
diff --git a/lib/node_modules/@stdlib/ndarray/with/lib/index.js b/lib/node_modules/@stdlib/ndarray/with/lib/index.js
new file mode 100644
index 000000000000..308b608a819e
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/with/lib/index.js
@@ -0,0 +1,53 @@
+/**
+* @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 a new ndarray with the element at a specified index replaced by a provided value.
+*
+* @module @stdlib/ndarray/with
+*
+* @example
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+* var ndarrayWith = require( '@stdlib/ndarray/with' );
+*
+* var buffer = [ 1, 2, 3, 4 ];
+* var shape = [ 2, 2 ];
+* var order = 'row-major';
+* var strides = [ 2, 1 ];
+* var offset = 0;
+*
+* var x = ndarray( 'generic', buffer, shape, strides, offset, order );
+* // returns
+*
+* var out = ndarrayWith( x, [ 0, 0 ], 5 );
+* // returns
+*
+* var v = out.get( 0, 0 );
+* // returns 5
+*/
+
+// MODULES //
+
+var ndarrayWith = require( './main.js' );
+
+
+// EXPORTS //
+
+module.exports = ndarrayWith;
diff --git a/lib/node_modules/@stdlib/ndarray/with/lib/main.js b/lib/node_modules/@stdlib/ndarray/with/lib/main.js
new file mode 100644
index 000000000000..dae26435a0fb
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/with/lib/main.js
@@ -0,0 +1,114 @@
+/**
+* @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 isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
+var isCollection = require( '@stdlib/assert/is-collection' );
+var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
+var getShape = require( '@stdlib/ndarray/shape' );
+var emptyLike = require( '@stdlib/ndarray/empty-like' );
+var normalizeIndex = require( '@stdlib/ndarray/base/normalize-index' );
+var assign = require( '@stdlib/ndarray/base/assign' );
+var resolveGetter = require( '@stdlib/array/base/resolve-getter' );
+var join = require( '@stdlib/array/base/join' );
+var format = require( '@stdlib/string/format' );
+
+
+// MAIN //
+
+/**
+* Returns a new ndarray with the element at a specified index replaced by a provided value.
+*
+* @param {ndarray} x - input ndarray
+* @param {IntegerArray} indices - indices of the element to replace
+* @param {*} value - value to set
+* @throws {TypeError} first argument must be an ndarray
+* @throws {TypeError} second argument must be an array of integers
+* @throws {RangeError} second argument must be an array of valid indices
+* @throws {RangeError} number of indices must equal the number of input ndarray dimensions
+* @returns {ndarray} output ndarray
+*
+* @example
+* var ndarray = require( '@stdlib/ndarray/ctor' );
+*
+* var buffer = [ 1, 2, 3, 4 ];
+* var shape = [ 2, 2 ];
+* var order = 'row-major';
+* var strides = [ 2, 1 ];
+* var offset = 0;
+*
+* var x = ndarray( 'generic', buffer, shape, strides, offset, order );
+*
+* var out = ndarrayWith( x, [ 0, 0 ], 5 );
+* // returns
+*
+* var v = out.get( 0, 0 );
+* // returns 5
+*/
+function ndarrayWith( x, indices, value ) {
+ var args;
+ var out;
+ var idx;
+ var get;
+ var sh;
+ var i;
+
+ if ( !isndarrayLike( x ) ) {
+ throw new TypeError( format( 'invalid argument. First argument must be an ndarray. Value: `%s`.', x ) );
+ }
+ if ( !isCollection( indices ) ) {
+ throw new TypeError( format( 'invalid argument. Second argument must be an array of integers. Value: `%s`.', indices ) );
+ }
+ sh = getShape( x );
+ if ( indices.length !== sh.length ) {
+ throw new RangeError( format( 'invalid argument. Number of indices does not match the number of array dimensions. Array shape: (%s). Number of indices: %u.', join( sh, ',' ), indices.length ) );
+ }
+ // Copy the input array:
+ out = emptyLike( x );
+ assign( [ x, out ] );
+
+ // Resolve an element accessor for retrieving indices:
+ get = resolveGetter( indices );
+
+ // Normalize the provided indices...
+ args = [];
+ for ( i = 0; i < sh.length; i++ ) {
+ idx = get( indices, i );
+ if ( !isInteger( idx ) ) {
+ throw new TypeError( format( 'invalid argument. Second argument must be an array of integers. Value: `%s`.', indices ) );
+ }
+ idx = normalizeIndex( idx, sh[ i ] );
+ if ( idx === -1 ) {
+ throw new RangeError( format( 'invalid argument. Second argument contains an out-of-bounds index. Array shape: (%s). Value: `[%s]`.', join( sh, ',' ), join( indices, ',' ) ) );
+ }
+ args.push( idx );
+ }
+ args.push( value );
+
+ // Set the element at the specified indices:
+ out.set.apply( out, args );
+ return out;
+}
+
+
+// EXPORTS //
+
+module.exports = ndarrayWith;
diff --git a/lib/node_modules/@stdlib/ndarray/with/package.json b/lib/node_modules/@stdlib/ndarray/with/package.json
new file mode 100644
index 000000000000..30ea9f2bab32
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/with/package.json
@@ -0,0 +1,64 @@
+{
+ "name": "@stdlib/ndarray/with",
+ "version": "0.0.0",
+ "description": "Returns a new ndarray with the element at a specified index replaced by a provided 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",
+ "stdtypes",
+ "types",
+ "data",
+ "structure",
+ "vector",
+ "ndarray",
+ "set",
+ "with",
+ "replace",
+ "copy"
+ ]
+}
diff --git a/lib/node_modules/@stdlib/ndarray/with/test/test.js b/lib/node_modules/@stdlib/ndarray/with/test/test.js
new file mode 100644
index 000000000000..88b55478913d
--- /dev/null
+++ b/lib/node_modules/@stdlib/ndarray/with/test/test.js
@@ -0,0 +1,172 @@
+/**
+* @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 zeros = require( '@stdlib/ndarray/zeros' );
+var ndarrayWith = require( './../lib' );
+
+
+// TESTS //
+
+tape( 'main export is a function', function test( t ) {
+ t.ok( true, __filename );
+ t.strictEqual( typeof ndarrayWith, 'function', 'main export is a function' );
+ t.end();
+});
+
+tape( 'the function throws an error if provided a first argument which is not an ndarray-like object', function test( t ) {
+ var values;
+ var i;
+
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [],
+ {},
+ function noop() {}
+ ];
+ for ( i = 0; i < values.length; i++ ) {
+ t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
+ }
+ t.end();
+
+ function badValue( value ) {
+ return function badValue() {
+ ndarrayWith( value, [ 0, 0, 0 ], 5 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument which is not an array of integers', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 3, 3, 3 ], {
+ 'dtype': 'float64'
+ });
+ values = [
+ '5',
+ 5,
+ NaN,
+ true,
+ false,
+ null,
+ void 0,
+ [ 0, '1', 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() {
+ ndarrayWith( x, value, 5 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument with out-of-bound indices', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 3, 3, 3 ], {
+ 'dtype': 'float64'
+ });
+ values = [
+ [ 3, 0, 0 ],
+ [ 1, 3, 0 ],
+ [ 1, 1, 3 ],
+ [ 3 ],
+ [ 1, 3 ],
+ [ 1, 1, 3, 0 ]
+ ];
+ 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() {
+ ndarrayWith( x, value, 5 );
+ };
+ }
+});
+
+tape( 'the function throws an error if provided a second argument whose length does not match the number of dimensions', function test( t ) {
+ var values;
+ var x;
+ var i;
+
+ x = zeros( [ 3, 3, 3 ], {
+ 'dtype': 'float64'
+ });
+ values = [
+ [],
+ [ 0 ],
+ [ 0, 0 ],
+ [ 0, 0, 0, 0 ],
+ [ 0, 0, 0, 0, 0 ]
+ ];
+ 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() {
+ ndarrayWith( x, value, 5 );
+ };
+ }
+});
+
+tape( 'the function returns a new ndarray with the element at a specified index replaced by a provided value', function test( t ) {
+ var out;
+ var x;
+
+ x = zeros( [ 3, 3, 3 ], {
+ 'dtype': 'float64'
+ });
+
+ out = ndarrayWith( x, [ 0, 0, 0 ], 1.0 );
+ t.notEqual( out, x, 'returns expected value' );
+ t.strictEqual( out.get( 0, 0, 0 ), 1.0, 'returns expected value' );
+
+ out = ndarrayWith( x, [ 1, 1, 1 ], 1.0 );
+ t.notEqual( out, x, 'returns expected value' );
+ t.strictEqual( out.get( 1, 1, 1 ), 1.0, 'returns expected value' );
+
+ out = ndarrayWith( x, [ 2, 2, 2 ], 1.0 );
+ t.notEqual( out, x, 'returns expected value' );
+ t.strictEqual( out.get( 2, 2, 2 ), 1.0, 'returns expected value' );
+
+ t.end();
+});