Skip to content

Commit 6e15664

Browse files
committed
refactor: use accessor utility and rename parameter
1 parent 86ef740 commit 6e15664

File tree

4 files changed

+18
-13
lines changed

4 files changed

+18
-13
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ limitations under the License.
4040
var ndarray2array = require( '@stdlib/ndarray/to-array' );
4141
```
4242

43-
#### ndarray2array( arr )
43+
#### ndarray2array( x )
4444

4545
Converts an [ndarray][@stdlib/ndarray/ctor] to a generic array (which may include nested arrays).
4646

@@ -53,10 +53,10 @@ var order = 'row-major';
5353
var strides = [ 2, 1 ];
5454
var offset = 0;
5555

56-
var arr = ndarray( 'generic', buffer, shape, strides, offset, order );
56+
var x = ndarray( 'generic', buffer, shape, strides, offset, order );
5757
// returns <ndarray>
5858

59-
var out = ndarray2array( arr );
59+
var out = ndarray2array( x );
6060
// returns [ [ 1, 2 ], [ 3, 4 ] ]
6161
```
6262

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11

2-
{{alias}}( arr )
2+
{{alias}}( x )
33
Converts an ndarray to a generic array.
44

55
Parameters
66
----------
7-
arr: ndarray
7+
x: ndarray
88
Input array.
99

1010
Returns

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { ndarray } from '@stdlib/types/ndarray';
2525
/**
2626
* Converts an ndarray to a generic array (which may include nested arrays).
2727
*
28-
* @param arr - input ndarray
28+
* @param x - input ndarray
2929
* @returns array (which may include nested arrays)
3030
*
3131
* @example
@@ -35,7 +35,7 @@ import { ndarray } from '@stdlib/types/ndarray';
3535
* var out = ndarray2array( arr );
3636
* // returns [ [ 1, 2 ], [ 3, 4 ] ]
3737
*/
38-
declare function ndarray2array( array: ndarray ): Array<any>;
38+
declare function ndarray2array( x: ndarray ): Array<any>;
3939

4040

4141
// EXPORTS //

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,21 @@
2121
// MODULES //
2222

2323
var isndarrayLike = require( '@stdlib/assert/is-ndarray-like' );
24-
var format = require( '@stdlib/string/format' );
2524
var toArray = require( '@stdlib/ndarray/base/to-array' );
25+
var getStrides = require( '@stdlib/ndarray/strides' );
26+
var getOffset = require( '@stdlib/ndarray/offset' );
27+
var getShape = require( '@stdlib/ndarray/shape' );
28+
var getOrder = require( '@stdlib/ndarray/order' );
29+
var getData = require( '@stdlib/ndarray/data-buffer' );
30+
var format = require( '@stdlib/string/format' );
2631

2732

2833
// MAIN //
2934

3035
/**
3136
* Converts an ndarray to a generic array (which may include nested arrays).
3237
*
33-
* @param {ndarrayLike} arr - input ndarray
38+
* @param {ndarrayLike} x - input ndarray
3439
* @throws {TypeError} must provide an ndarray
3540
* @returns {(EmptyArray|Array|Array<Array>)} array (which may include nested arrays)
3641
*
@@ -48,11 +53,11 @@ var toArray = require( '@stdlib/ndarray/base/to-array' );
4853
* var out = ndarray2array( arr );
4954
* // returns [ [ 1, 2 ], [ 3, 4 ] ]
5055
*/
51-
function ndarray2array( arr ) {
52-
if ( !isndarrayLike( arr ) ) {
53-
throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', arr ) );
56+
function ndarray2array( x ) {
57+
if ( !isndarrayLike( x ) ) {
58+
throw new TypeError( format( 'invalid argument. Must provide an ndarray. Value: `%s`.', x ) );
5459
}
55-
return toArray( arr.data, arr.shape, arr.strides, arr.offset, arr.order );
60+
return toArray( getData( x ), getShape( x ), getStrides( x ), getOffset( x ), getOrder( x ) ); // eslint-disable-line max-len
5661
}
5762

5863

0 commit comments

Comments
 (0)