Skip to content

Commit 999db0e

Browse files
committed
chore: apply suggestions from code review
--- 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: na - task: lint_javascript_src status: passed - task: lint_javascript_cli status: na - task: lint_javascript_examples status: passed - task: lint_javascript_tests status: passed - 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: na - task: lint_license_headers status: passed ---
1 parent a662c35 commit 999db0e

File tree

4 files changed

+19
-30
lines changed

4 files changed

+19
-30
lines changed

lib/node_modules/@stdlib/ndarray/to-reversed/README.md

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,12 @@ var toReversed = require( '@stdlib/ndarray/to-reversed' );
4545
Returns a new [`ndarray`][@stdlib/ndarray/ctor] where the order of elements of an input [`ndarray`][@stdlib/ndarray/ctor] is reversed along each dimension.
4646

4747
```javascript
48-
var ndarray = require( '@stdlib/ndarray/ctor' );
48+
var array = require( '@stdlib/ndarray/array' );
4949
var ndarray2array = require( '@stdlib/ndarray/to-array' );
5050

51-
var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ];
52-
var shape = [ 3, 2 ];
53-
var strides = [ 2, 1 ];
54-
var offset = 0;
55-
56-
var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
51+
var x = array( [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0 ], {
52+
'shape': [ 3, 2 ]
53+
});
5754
// returns <ndarray>
5855

5956
var arr = ndarray2array( x );
@@ -87,23 +84,14 @@ arr = ndarray2array( y );
8784
<!-- eslint no-undef: "error" -->
8885

8986
```javascript
90-
var ndarray = require( '@stdlib/ndarray/ctor' );
87+
var uniform = require( '@stdlib/random/uniform' );
9188
var ndarray2array = require( '@stdlib/ndarray/to-array' );
9289
var toReversed = require( '@stdlib/ndarray/to-reversed' );
9390

94-
var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ];
95-
var shape = [ 2, 2, 2 ];
96-
var strides = [ 4, 2, 1 ];
97-
var offset = 0;
98-
99-
var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
100-
// returns <ndarray>
101-
91+
var x = uniform( [ 3, 3, 3 ], -10.0, 10.0 );
10292
console.log( ndarray2array( x ) );
10393

10494
var y = toReversed( x );
105-
// returns <ndarray>
106-
10795
console.log( ndarray2array( y ) );
10896
```
10997

lib/node_modules/@stdlib/ndarray/to-reversed/examples/index.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,12 @@
1818

1919
'use strict';
2020

21-
var ndarray = require( '@stdlib/ndarray/ctor' );
21+
var uniform = require( '@stdlib/random/uniform' );
2222
var ndarray2array = require( '@stdlib/ndarray/to-array' );
2323
var toReversed = require( './../lib' );
2424

25-
var buffer = [ 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0 ];
26-
var shape = [ 2, 2, 2 ];
27-
var strides = [ 4, 2, 1 ];
28-
var offset = 0;
29-
30-
var x = ndarray( 'generic', buffer, shape, strides, offset, 'row-major' );
31-
// returns <ndarray>
32-
25+
var x = uniform( [ 3, 3, 3 ], -10.0, 10.0 );
3326
console.log( ndarray2array( x ) );
3427

3528
var y = toReversed( x );
36-
// returns <ndarray>
37-
3829
console.log( ndarray2array( y ) );

lib/node_modules/@stdlib/ndarray/to-reversed/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ var format = require( '@stdlib/string/format' );
3131
* Returns a new ndarray where the order of elements of an input ndarray is reversed along each dimension.
3232
*
3333
* @param {ndarray} x - input array
34-
* @throws {TypeError} first argument must be an ndarray having one or more dimensions
34+
* @throws {TypeError} first argument must be an ndarray
3535
* @returns {ndarray} output ndarray
3636
*
3737
* @example

lib/node_modules/@stdlib/ndarray/to-reversed/test/test.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@
2121
// MODULES //
2222

2323
var tape = require( 'tape' );
24+
var isEqualDataType = require( '@stdlib/ndarray/base/assert/is-equal-data-type' );
2425
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
2526
var zeroTo = require( '@stdlib/array/zero-to' );
2627
var scalar2ndarray = require( '@stdlib/ndarray/from-scalar' );
2728
var getShape = require( '@stdlib/ndarray/shape' );
29+
var getDType = require( '@stdlib/ndarray/dtype' );
2830
var ndarray2array = require( '@stdlib/ndarray/to-array' );
2931
var ndarray = require( '@stdlib/ndarray/ctor' );
3032
var toReversed = require( './../lib' );
@@ -78,9 +80,11 @@ tape( 'the function returns a new zero-dimensional ndarray if provided a zero-di
7880

7981
actual = toReversed( x );
8082

83+
t.notEqual( actual, x, 'returns expected value' );
8184
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
8285
t.strictEqual( actual.get(), x.get(), 'returns expected value' );
8386
t.deepEqual( getShape( x ), getShape( actual ), 'returns expected value' );
87+
t.strictEqual( isEqualDataType( getDType( actual ), getDType( x ) ), true, 'returns expected value' );
8488

8589
t.end();
8690
});
@@ -106,8 +110,10 @@ tape( 'the function returns a new ndarray where the order of elements along each
106110
actual = toReversed( x );
107111
expected = [ 8, 6, 4, 2, 0 ];
108112

113+
t.notEqual( actual, x, 'returns expected value' );
109114
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
110115
t.deepEqual( getShape( x ), getShape( actual ), 'returns exepcted value' );
116+
t.strictEqual( isEqualDataType( getDType( actual ), getDType( x ) ), true, 'returns expected value' );
111117
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
112118

113119
t.end();
@@ -138,8 +144,10 @@ tape( 'the function returns a new ndarray where the order of elements along each
138144
[ 2, 0 ]
139145
];
140146

147+
t.notEqual( actual, x, 'returns expected value' );
141148
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
142149
t.deepEqual( getShape( x ), getShape( actual ), 'returns expected value' );
150+
t.strictEqual( isEqualDataType( getDType( actual ), getDType( x ) ), true, 'returns expected value' );
143151
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
144152

145153
t.end();
@@ -177,8 +185,10 @@ tape( 'the function returns a new ndarray where the order of elements along each
177185
]
178186
];
179187

188+
t.notEqual( actual, x, 'returns expected value' );
180189
t.strictEqual( isndarrayLike( actual ), true, 'returns expected value' );
181190
t.deepEqual( getShape( x ), getShape( actual ), 'returns expected value' );
191+
t.strictEqual( isEqualDataType( getDType( actual ), getDType( x ) ), true, 'returns expected value' );
182192
t.deepEqual( ndarray2array( actual ), expected, 'returns expected value' );
183193

184194
t.end();

0 commit comments

Comments
 (0)