Skip to content

Commit 558f8d1

Browse files
committed
refactor: 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: passed - 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: 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: passed - task: lint_license_headers status: passed ---
1 parent 5da5402 commit 558f8d1

File tree

7 files changed

+288
-40
lines changed

7 files changed

+288
-40
lines changed

lib/node_modules/@stdlib/ndarray/flatten-from/README.md

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ limitations under the License.
2020

2121
# flattenFrom
2222

23-
> Return a copy of an input [ndarray][@stdlib/ndarray/ctor], where all dimensions of the input [ndarray][@stdlib/ndarray/ctor] are flattened starting from a specific dimension.
23+
> Return a copy of an input [ndarray][@stdlib/ndarray/ctor], where all dimensions of the input [ndarray][@stdlib/ndarray/ctor] are flattened starting from a specified dimension.
2424
2525
<section class="intro">
2626

@@ -38,25 +38,18 @@ var flattenFrom = require( '@stdlib/ndarray/flatten-from' );
3838

3939
#### flattenFrom( x, dim\[, options] )
4040

41-
Returns a copy of an input [ndarray][@stdlib/ndarray/ctor], where all dimensions of the input [ndarray][@stdlib/ndarray/ctor] are flattened starting from a specific dimension.
41+
Returns a copy of an input [ndarray][@stdlib/ndarray/ctor], where all dimensions of the input [ndarray][@stdlib/ndarray/ctor] are flattened starting from a specified dimension.
4242

4343
```javascript
4444
var array = require( '@stdlib/ndarray/array' );
45-
var shape = require( '@stdlib/ndarray/shape' );
4645
var ndarray2array = require( '@stdlib/ndarray/to-array' );
4746

4847
var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
4948
// returns <ndarray>
5049

51-
var shx = shape( x );
52-
// returns [ 3, 1, 2 ]
53-
5450
var y = flattenFrom( x, 1 );
5551
// returns <ndarray>
5652

57-
var shy = shape( y );
58-
// returns [ 3, 2 ]
59-
6053
var arr = ndarray2array( y );
6154
// returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
6255
```
@@ -84,23 +77,16 @@ By default, the input [ndarray][@stdlib/ndarray/ctor] is flattened in lexicograp
8477

8578
```javascript
8679
var array = require( '@stdlib/ndarray/array' );
87-
var shape = require( '@stdlib/ndarray/shape' );
8880
var ndarray2array = require( '@stdlib/ndarray/to-array' );
8981

9082
var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
9183
// returns <ndarray>
9284

93-
var shx = shape( x );
94-
// returns [ 3, 1, 2 ]
95-
9685
var y = flattenFrom( x, 0, {
9786
'order': 'column-major'
9887
});
9988
// returns <ndarray>
10089

101-
var shy = shape( y );
102-
// returns [ 6 ]
103-
10490
var arr = ndarray2array( y );
10591
// returns [ 1.0, 3.0, 5.0, 2.0, 4.0, 6.0 ]
10692
```
@@ -110,23 +96,16 @@ By default, the output ndarray [data type][@stdlib/ndarray/dtypes] is inferred f
11096
```javascript
11197
var array = require( '@stdlib/ndarray/array' );
11298
var dtype = require( '@stdlib/ndarray/dtype' );
113-
var shape = require( '@stdlib/ndarray/shape' );
11499
var ndarray2array = require( '@stdlib/ndarray/to-array' );
115100

116101
var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
117102
// returns <ndarray>
118103

119-
var shx = shape( x );
120-
// returns [ 3, 1, 2 ]
121-
122104
var y = flattenFrom( x, 0, {
123105
'dtype': 'float32'
124106
});
125107
// returns <ndarray>
126108

127-
var shy = shape( y );
128-
// returns [ 6 ]
129-
130109
var dt = dtype( y );
131110
// returns 'float32'
132111

lib/node_modules/@stdlib/ndarray/flatten-from/docs/repl.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
{{alias}}( x, dim[, options] )
33
Returns a copy of an input ndarray, where all dimensions of the input
4-
ndarray are flattened starting from a specific dimension.
4+
ndarray are flattened starting from a specified dimension.
55

66
The function always returns a copy of input ndarray data, even when an input
77
ndarray already has the desired number of dimensions.

lib/node_modules/@stdlib/ndarray/flatten-from/docs/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type Options<U> = BaseOptions & {
5454
};
5555

5656
/**
57-
* Returns a copy of an input ndarray, where all dimensions of the input ndarray are flattened starting from a specific dimension.
57+
* Returns a copy of an input ndarray, where all dimensions of the input ndarray are flattened starting from a specified dimension.
5858
*
5959
* ## Notes
6060
*
@@ -91,7 +91,7 @@ type Options<U> = BaseOptions & {
9191
declare function flattenFrom<T extends ndarray>( x: T, dim: number, options?: BaseOptions ): T;
9292

9393
/**
94-
* Returns a copy of an input ndarray, where all dimensions of the input ndarray are flattened starting from a specific dimension.
94+
* Returns a copy of an input ndarray, where all dimensions of the input ndarray are flattened starting from a specified dimension.
9595
*
9696
* ## Notes
9797
*

lib/node_modules/@stdlib/ndarray/flatten-from/lib/index.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,23 @@
1919
'use strict';
2020

2121
/**
22-
* Return a copy of an input ndarray, where all dimensions of the input ndarray are flattened starting from a specific dimension.
22+
* Return a copy of an input ndarray, where all dimensions of the input ndarray are flattened starting from a specified dimension.
2323
*
2424
* @module @stdlib/ndarray/flatten-from
2525
*
2626
* @example
2727
* var array = require( '@stdlib/ndarray/array' );
28-
* var shape = require( '@stdlib/ndarray/shape' );
2928
* var ndarray2array = require( '@stdlib/ndarray/to-array' );
3029
* var flattenFrom = require( '@stdlib/ndarray/flatten-from' );
3130
*
3231
* // Create an input ndarray:
3332
* var x = array( [ [ [ 1.0, 2.0 ] ], [ [ 3.0, 4.0 ] ], [ [ 5.0, 6.0 ] ] ] );
3433
* // returns <ndarray>
3534
*
36-
* var shx = shape( x );
37-
* // returns [ 3, 1, 2 ]
38-
*
3935
* // Flatten the input ndarray:
4036
* var y = flattenFrom( x, 1 );
4137
* // returns <ndarray>
4238
*
43-
* var shy = shape( y );
44-
* // returns [ 3, 2 ]
45-
*
4639
* var arr = ndarray2array( y );
4740
* // returns [ [ 1, 2 ], [ 3, 4 ], [ 5, 6 ] ]
4841
*/

lib/node_modules/@stdlib/ndarray/flatten-from/lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ var COL_MAJOR = 'column-major';
4848
// MAIN //
4949

5050
/**
51-
* Returns a copy of an input ndarray, where all dimensions of the input ndarray are flattened starting from a specific dimension.
51+
* Returns a copy of an input ndarray, where all dimensions of the input ndarray are flattened starting from a specified dimension.
5252
*
5353
* @param {ndarray} x - input ndarray
5454
* @param {integer} dim - dimension to start flattening from.

lib/node_modules/@stdlib/ndarray/flatten-from/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@stdlib/ndarray/flatten-from",
33
"version": "0.0.0",
4-
"description": "Return a copy of an input ndarray, where all dimensions of the input ndarray are flattened starting from a specific dimension.",
4+
"description": "Return a copy of an input ndarray, where all dimensions of the input ndarray are flattened starting from a specified dimension.",
55
"license": "Apache-2.0",
66
"author": {
77
"name": "The Stdlib Authors",

0 commit comments

Comments
 (0)