Skip to content

Commit

Permalink
refactor: use accessor utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Oct 8, 2023
1 parent ab25d92 commit 5325a1c
Showing 1 changed file with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ var accessorSetter = require( '@stdlib/array/base/accessor-setter' );
var getter = require( '@stdlib/array/base/getter' );
var setter = require( '@stdlib/array/base/setter' );
var numel = require( '@stdlib/ndarray/base/numel' );
var getDType = require( '@stdlib/ndarray/base/dtype' );
var getShape = require( '@stdlib/ndarray/base/shape' );
var getStrides = require( '@stdlib/ndarray/base/strides' );
var getOffset = require( '@stdlib/ndarray/base/offset' );
var getOrder = require( '@stdlib/ndarray/base/order' );
var getData = require( '@stdlib/ndarray/base/data-buffer' );


// MAIN //
Expand Down Expand Up @@ -73,9 +79,9 @@ function ndarraylike2object( x ) {
var sh;
var dt;

xbuf = x.data;
sh = x.shape;
dt = x.dtype;
xbuf = getData( x );
sh = getShape( x );
dt = getDType( x );

bool = isAccessorArray( xbuf );

Expand All @@ -85,9 +91,9 @@ function ndarraylike2object( x ) {
'data': xbuf,
'length': numel( sh ),
'shape': sh,
'strides': x.strides,
'offset': x.offset,
'order': x.order,
'strides': getStrides( x ),
'offset': getOffset( x ),
'order': getOrder( x ),
'accessorProtocol': bool,
'accessors': ( bool ) ?
[ accessorGetter( dt ), accessorSetter( dt ) ] :
Expand Down

1 comment on commit 5325a1c

@stdlib-bot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage Report

Package Statements Branches Functions Lines
ndarray/base/expand-dimensions $\color{red}207/211$
$\color{green}+98.10\%$
$\color{red}19/21$
$\color{green}+90.48\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{red}207/211$
$\color{green}+98.10\%$
ndarray/base/maybe-broadcast-array $\color{green}180/180$
$\color{green}+100.00\%$
$\color{green}8/8$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}180/180$
$\color{green}+100.00\%$
ndarray/base/ndarraylike2object $\color{green}150/150$
$\color{green}+100.00\%$
$\color{green}5/5$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}150/150$
$\color{green}+100.00\%$

The above coverage report was generated for the changes in this push.

Please sign in to comment.