Skip to content

Commit 1a45821

Browse files
committed
docs: update examples to use accessor functions
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: passed - task: lint_package_json status: na - task: lint_repl_help status: passed - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent e835a44 commit 1a45821

5 files changed

Lines changed: 19 additions & 50 deletions

File tree

lib/node_modules/@stdlib/ndarray/base/to-flippedud/README.md

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,24 @@ Returns a new ndarray where the order of elements along the second-to-last dimen
4646

4747
```javascript
4848
var ndarray = require( '@stdlib/ndarray/ctor' );
49-
var ndarray2array = require( '@stdlib/ndarray/to-array' );
49+
var getShape = require( '@stdlib/ndarray/shape' );
5050

5151
var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
5252
var shape = [ 3, 2 ];
5353
var strides = [ 2, 1 ];
5454
var offset = 0;
5555

5656
var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
57-
// returns <ndarray>
57+
// returns <ndarray>[ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
5858

59-
var sh = x.shape;
59+
var sh = getShape( x );
6060
// returns [ 3, 2 ]
6161

62-
var arr = ndarray2array( x );
63-
// returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
64-
6562
var y = toFlippedud( x );
66-
// returns <ndarray>
63+
// returns <ndarray>[ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
6764

68-
sh = y.shape;
65+
sh = getShape( y );
6966
// returns [ 3, 2 ]
70-
71-
arr = ndarray2array( y );
72-
// returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
7367
```
7468

7569
The function accepts the following arguments:

lib/node_modules/@stdlib/ndarray/base/to-flippedud/docs/repl.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,9 @@
1616
Examples
1717
--------
1818
> var x = {{alias:@stdlib/ndarray/array}}( [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ] )
19-
<ndarray>
20-
> x.shape
21-
[ 3, 2 ]
19+
<ndarray>[ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
2220
> var y = {{alias}}( x )
23-
<ndarray>
24-
> y.shape
25-
[ 3, 2 ]
26-
> {{alias:@stdlib/ndarray/to-array}}( y )
27-
[ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
21+
<ndarray>[ [ 5, 6 ], [ 3, 4 ], [ 1, 2 ] ]
2822

2923
See Also
3024
--------

lib/node_modules/@stdlib/ndarray/base/to-flippedud/docs/types/index.d.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,31 +30,25 @@ import { ndarray } from '@stdlib/types/ndarray';
3030
*
3131
* @example
3232
* var typedarray = require( '@stdlib/array/typed' );
33+
* var getShape = require( '@stdlib/ndarray/shape' );
3334
* var ndarray = require( '@stdlib/ndarray/ctor' );
34-
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
3535
*
3636
* var buffer = typedarray( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], 'float64' );
3737
* var shape = [ 3, 2 ];
3838
* var strides = [ 2, 1 ];
3939
* var offset = 0;
4040
*
4141
* var x = ndarray( 'float64', buffer, shape, strides, offset, 'row-major' );
42-
* // returns <ndarray>
42+
* // returns <ndarray>[ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
4343
*
44-
* var sh = x.shape;
44+
* var sh = getShape( x );
4545
* // returns [ 3, 2 ]
4646
*
47-
* var arr = ndarray2array( x );
48-
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
49-
*
5047
* var y = toFlippedud( x );
51-
* // returns <ndarray>
48+
* // returns <ndarray>[ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
5249
*
53-
* sh = y.shape;
50+
* sh = getShape( y );
5451
* // returns [ 3, 2 ]
55-
*
56-
* arr = ndarray2array( y );
57-
* // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
5852
*/
5953
declare function toFlippedud<T extends ndarray>( x: T ): T;
6054

lib/node_modules/@stdlib/ndarray/base/to-flippedud/lib/index.js

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
*
2626
* @example
2727
* var ndarray = require( '@stdlib/ndarray/ctor' );
28-
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
2928
* var toFlippedud = require( '@stdlib/ndarray/base/to-flippedud' );
3029
*
3130
* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
@@ -34,16 +33,10 @@
3433
* var offset = 0;
3534
*
3635
* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
37-
* // returns <ndarray>
38-
*
39-
* var arr = ndarray2array( x );
40-
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
36+
* // returns <ndarray>[ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
4137
*
4238
* var y = toFlippedud( x );
43-
* // returns <ndarray>
44-
*
45-
* arr = ndarray2array( y );
46-
* // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
39+
* // returns <ndarray>[ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
4740
*/
4841

4942
// MODULES //

lib/node_modules/@stdlib/ndarray/base/to-flippedud/lib/main.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,30 +36,24 @@ var ndims = require( '@stdlib/ndarray/base/ndims' );
3636
*
3737
* @example
3838
* var ndarray = require( '@stdlib/ndarray/ctor' );
39-
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
39+
* var getShape = require( '@stdlib/ndarray/shape' );
4040
*
4141
* var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
4242
* var shape = [ 3, 2 ];
4343
* var strides = [ 2, 1 ];
4444
* var offset = 0;
4545
*
4646
* var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
47-
* // returns <ndarray>
47+
* // returns <ndarray>[ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
4848
*
49-
* var sh = x.shape;
49+
* var sh = getShape( x );
5050
* // returns [ 3, 2 ]
5151
*
52-
* var arr = ndarray2array( x );
53-
* // returns [ [ 1.0, 2.0 ], [ 3.0, 4.0 ], [ 5.0, 6.0 ] ]
54-
*
5552
* var y = toFlippedud( x );
56-
* // returns <ndarray>
53+
* // returns <ndarray>[ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
5754
*
58-
* sh = y.shape;
55+
* sh = getShape( y );
5956
* // returns [ 3, 2 ]
60-
*
61-
* arr = ndarray2array( y );
62-
* // returns [ [ 5.0, 6.0 ], [ 3.0, 4.0 ], [ 1.0, 2.0 ] ]
6357
*/
6458
function toFlippedud( x ) {
6559
var out;

0 commit comments

Comments
 (0)