Skip to content

Commit 3609aed

Browse files
authored
docs: improve doctests for ndarray instances in ndarray/with
PR-URL: #11476 Ref: #9329 Reviewed-by: Athan Reines <kgryte@gmail.com>
1 parent 8ac07be commit 3609aed

File tree

5 files changed

+6
-19
lines changed

5 files changed

+6
-19
lines changed

lib/node_modules/@stdlib/ndarray/with/README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,7 @@ var x = zeros( [ 2, 2 ], {
5353
// returns <ndarray>
5454

5555
var out = ndarrayWith( x, [ 0, 0 ], 1.0 );
56-
// returns <ndarray>
57-
58-
var v = out.get( 0, 0 );
59-
// returns 1.0
56+
// returns <ndarray>[ [ 1, 0 ], [ 0, 0 ] ]
6057
```
6158

6259
The function accepts the following arguments:

lib/node_modules/@stdlib/ndarray/with/docs/repl.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
Examples
2323
--------
2424
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2 ], [ 3, 4 ] ] );
25-
> var out = {{alias}}( x, [ 0, 0 ], 5 );
26-
> var v = out.get( 0, 0 )
27-
5
25+
> var out = {{alias}}( x, [ 0, 0 ], 5 )
26+
<ndarray>[ [ 5, 2 ], [ 3, 4 ] ]
2827

2928
See Also
3029
--------

lib/node_modules/@stdlib/ndarray/with/docs/types/index.d.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,7 @@ import { typedndarray } from '@stdlib/types/ndarray';
4242
* var x = ndarray( 'generic', buffer, shape, strides, offset, order );
4343
*
4444
* var out = ndarrayWith( x, [ 0, 0 ], 5 );
45-
* // returns <ndarray>
46-
*
47-
* var v = out.get( 0, 0 );
48-
* // returns 5
45+
* // returns <ndarray>[ [ 5, 2 ], [ 3, 4 ] ]
4946
*/
5047
declare function ndarrayWith<T = unknown, U extends typedndarray<T> = typedndarray<T>>( x: typedndarray<T>, indices: Array<number>, value: T ): U;
5148

lib/node_modules/@stdlib/ndarray/with/lib/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@
3737
* // returns <ndarray>
3838
*
3939
* var out = ndarrayWith( x, [ 0, 0 ], 5 );
40-
* // returns <ndarray>
41-
*
42-
* var v = out.get( 0, 0 );
43-
* // returns 5
40+
* // returns <ndarray>[ [ 5, 2 ], [ 3, 4 ] ]
4441
*/
4542

4643
// MODULES //

lib/node_modules/@stdlib/ndarray/with/lib/main.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,7 @@ var format = require( '@stdlib/string/format' );
5858
* var x = ndarray( 'generic', buffer, shape, strides, offset, order );
5959
*
6060
* var out = ndarrayWith( x, [ 0, 0 ], 5 );
61-
* // returns <ndarray>
62-
*
63-
* var v = out.get( 0, 0 );
64-
* // returns 5
61+
* // returns <ndarray>[ [ 5, 2 ], [ 3, 4 ] ]
6562
*/
6663
function ndarrayWith( x, indices, value ) {
6764
var args;

0 commit comments

Comments
 (0)