Skip to content

Commit 3b9072f

Browse files
committed
Auto-generated commit
1 parent 198f2ac commit 3b9072f

File tree

9 files changed

+62
-413
lines changed

9 files changed

+62
-413
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The [branches.md][branches-url] file summarizes the available branches and displ
7171
var ndarray2array = require( '@stdlib/ndarray-to-array' );
7272
```
7373

74-
#### ndarray2array( arr )
74+
#### ndarray2array( x )
7575

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

@@ -84,10 +84,10 @@ var order = 'row-major';
8484
var strides = [ 2, 1 ];
8585
var offset = 0;
8686

87-
var arr = ndarray( 'generic', buffer, shape, strides, offset, order );
87+
var x = ndarray( 'generic', buffer, shape, strides, offset, order );
8888
// returns <ndarray>
8989

90-
var out = ndarray2array( arr );
90+
var out = ndarray2array( x );
9191
// returns [ [ 1, 2 ], [ 3, 4 ] ]
9292
```
9393

dist/index.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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

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/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

package.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
"dependencies": {
4040
"@stdlib/assert-is-ndarray-like": "^0.1.0",
4141
"@stdlib/ndarray-base-to-array": "^0.1.0",
42+
"@stdlib/ndarray-data-buffer": "github:stdlib-js/ndarray-data-buffer#main",
43+
"@stdlib/ndarray-offset": "github:stdlib-js/ndarray-offset#main",
44+
"@stdlib/ndarray-order": "github:stdlib-js/ndarray-order#main",
45+
"@stdlib/ndarray-shape": "github:stdlib-js/ndarray-shape#main",
46+
"@stdlib/ndarray-strides": "github:stdlib-js/ndarray-strides#main",
4247
"@stdlib/string-format": "^0.1.1",
4348
"@stdlib/types": "^0.1.0"
4449
},
@@ -48,8 +53,8 @@
4853
"@stdlib/assert-is-array": "^0.1.1",
4954
"@stdlib/assert-is-array-array": "^0.1.1",
5055
"@stdlib/bench": "^0.1.0",
51-
"@stdlib/complex-imagf": "^0.1.0",
52-
"@stdlib/complex-realf": "^0.1.0",
56+
"@stdlib/complex-imagf": "^0.1.1",
57+
"@stdlib/complex-realf": "^0.1.1",
5358
"@stdlib/ndarray-base-numel": "^0.1.1",
5459
"@stdlib/ndarray-base-shape2strides": "^0.1.1",
5560
"@stdlib/ndarray-base-strides2offset": "^0.1.1",

0 commit comments

Comments
 (0)