Skip to content

Commit 5325a1c

Browse files
committed
refactor: use accessor utilities
1 parent ab25d92 commit 5325a1c

File tree

1 file changed

+12
-6
lines changed
  • lib/node_modules/@stdlib/ndarray/base/ndarraylike2object/lib

1 file changed

+12
-6
lines changed

lib/node_modules/@stdlib/ndarray/base/ndarraylike2object/lib/main.js

+12-6
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ var accessorSetter = require( '@stdlib/array/base/accessor-setter' );
2626
var getter = require( '@stdlib/array/base/getter' );
2727
var setter = require( '@stdlib/array/base/setter' );
2828
var numel = require( '@stdlib/ndarray/base/numel' );
29+
var getDType = require( '@stdlib/ndarray/base/dtype' );
30+
var getShape = require( '@stdlib/ndarray/base/shape' );
31+
var getStrides = require( '@stdlib/ndarray/base/strides' );
32+
var getOffset = require( '@stdlib/ndarray/base/offset' );
33+
var getOrder = require( '@stdlib/ndarray/base/order' );
34+
var getData = require( '@stdlib/ndarray/base/data-buffer' );
2935

3036

3137
// MAIN //
@@ -73,9 +79,9 @@ function ndarraylike2object( x ) {
7379
var sh;
7480
var dt;
7581

76-
xbuf = x.data;
77-
sh = x.shape;
78-
dt = x.dtype;
82+
xbuf = getData( x );
83+
sh = getShape( x );
84+
dt = getDType( x );
7985

8086
bool = isAccessorArray( xbuf );
8187

@@ -85,9 +91,9 @@ function ndarraylike2object( x ) {
8591
'data': xbuf,
8692
'length': numel( sh ),
8793
'shape': sh,
88-
'strides': x.strides,
89-
'offset': x.offset,
90-
'order': x.order,
94+
'strides': getStrides( x ),
95+
'offset': getOffset( x ),
96+
'order': getOrder( x ),
9197
'accessorProtocol': bool,
9298
'accessors': ( bool ) ?
9399
[ accessorGetter( dt ), accessorSetter( dt ) ] :

0 commit comments

Comments
 (0)