Skip to content

Commit

Permalink
refactor: use base utility to construct MultiSlice from args array
Browse files Browse the repository at this point in the history
  • Loading branch information
kgryte committed Sep 24, 2023
1 parent 86f3be7 commit f5f669f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 70 deletions.
6 changes: 3 additions & 3 deletions lib/node_modules/@stdlib/ndarray/fancy/lib/get.nd.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ var isFunction = require( '@stdlib/assert/is-function' );
var trim = require( '@stdlib/string/base/trim' );
var str2multislice = require( '@stdlib/slice/base/str2multislice' );
var seq2multislice = require( '@stdlib/slice/base/seq2multislice' );
var sargs2multislice = require( '@stdlib/slice/base/sargs2multislice' );
var format = require( '@stdlib/string/format' );
var hasProperty = require( './has_property.js' );
var RE_SUBSEQ = require( './re_subseq.js' );
var multisliceWrap = require( './wrap_multislice_arguments.js' );
var sliceView = require( './view.nd.js' );
var empty = require( './empty.js' );

Expand Down Expand Up @@ -104,9 +104,9 @@ function get( target, property, receiver ) {
}
// Case: array syntax (e.g., [ Slice(0,10,1), null, Slice(4,null,-1) ])

// TODO: => @stdlib/ndarray/base/slice: return slice( receiver, str2multislice( multisliceWrap( prop ) ).data ); // TODO: handle `null`
// TODO: => @stdlib/ndarray/base/slice: return slice( receiver, sargs2multislice( prop ).data ); // TODO: handle `null`

Check warning on line 107 in lib/node_modules/@stdlib/ndarray/fancy/lib/get.nd.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: => @stdlib/ndarray/base/slice:...'

return sliceView( target, '['+property+']', receiver, str2multislice( multisliceWrap( prop ) ) );
return sliceView( target, '['+property+']', receiver, sargs2multislice( prop ) );

/**
* Method wrapper.
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/ndarray/fancy/lib/slice_start.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ var sub2ind = require( '@stdlib/ndarray/base/sub2ind' );
// MAIN //

/**
* Resolves the linear index of the first element indexed by a multi-slice.
* Resolves the linear index of the first element indexed by a normalized multi-slice.
*
* ## Notes
*
* - If `strides` contains negative strides, if an `offset` is greater than `0`, the function returns a linear index with respect to the underlying data buffer. If an `offset` is equal to `0`, the function returns a linear index with respect to the array view. For more information, see `@stdlib/ndarray/base/sub2ind`.
*
* @private
* @param {MultiSlice} slice - multi-slice object
* @param {MultiSlice} slice - normalized multi-slice object
* @param {NonNegativeIntegerArray} shape - array shape
* @param {IntegerArray} strides - array strides
* @param {NonNegativeInteger} offset - index offset
Expand Down
4 changes: 2 additions & 2 deletions lib/node_modules/@stdlib/ndarray/fancy/lib/slice_strides.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
// MAIN //

/**
* Resolves slice strides.
* Resolves slice strides for a provided normalized multi-slice object.
*
* @private
* @param {MultiSlice} slice - multi-slice object
* @param {MultiSlice} slice - normalized multi-slice object
* @param {IntegerArray} strides - array strides
* @param {NonNegativeIntegerArray} sdims - indices of non-reduced dimensions
* @returns {IntegerArray} slice strides
Expand Down
2 changes: 1 addition & 1 deletion lib/node_modules/@stdlib/ndarray/fancy/lib/view.nd.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function sliceView( target, property, receiver, slice ) {
return empty( ctor, dtype, take( sh, sdims ), order );
}
// Resolve the index offset of the first element:
offset = vind2bind( shape, strides, offset, order, sliceStart( ns, shape, strides, 0 ), 'throw' );
offset = vind2bind( shape, strides, offset, order, sliceStart( ns, shape, strides, 0 ), 'throw' ); // TODO: @stdlib/ndarray/base/sind2bind

Check warning on line 100 in lib/node_modules/@stdlib/ndarray/fancy/lib/view.nd.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected 'todo' comment: 'TODO: @stdlib/ndarray/base/sind2bind'

// Remove reduced dimensions from the slice shape:
sh = take( sh, sdims );
Expand Down

This file was deleted.

1 comment on commit f5f669f

@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/fancy $\color{red}740/1179$
$\color{green}+62.77\%$
$\color{red}25/27$
$\color{green}+92.59\%$
$\color{red}1/10$
$\color{green}+10.00\%$
$\color{red}740/1179$
$\color{green}+62.77\%$
slice/base $\color{green}150/150$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}0/0$
$\color{green}+100.00\%$
$\color{green}150/150$
$\color{green}+100.00\%$
slice/base/sargs2multislice $\color{green}146/146$
$\color{green}+100.00\%$
$\color{green}3/3$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}146/146$
$\color{green}+100.00\%$
slice/base/str2multislice $\color{green}185/185$
$\color{green}+100.00\%$
$\color{green}20/20$
$\color{green}+100.00\%$
$\color{green}1/1$
$\color{green}+100.00\%$
$\color{green}185/185$
$\color{green}+100.00\%$

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

Please sign in to comment.