2121// MODULES //
2222
2323var normalizeMultiSlice = require ( '@stdlib/slice/base/normalize-multi-slice' ) ;
24+ var nonreducedDimensions = require ( '@stdlib/slice/base/nonreduced-dimensions' ) ;
2425var sliceShape = require ( '@stdlib/slice/base/shape' ) ;
2526var take = require ( '@stdlib/array/base/take' ) ;
2627var vind2bind = require ( '@stdlib/ndarray/base/vind2bind' ) ;
2728var numel = require ( '@stdlib/ndarray/base/numel' ) ;
2829var format = require ( '@stdlib/string/format' ) ;
29- var nonreducedDimensions = require ( '@stdlib/slice/base/nonreduced-dimensions' ) ;
3030var sliceStart = require ( './slice_start.js' ) ;
3131var sliceStrides = require ( './slice_strides.js' ) ;
3232var options = require ( './array_options.js' ) ;
@@ -58,6 +58,7 @@ function sliceView( target, property, receiver, slice ) {
5858 var sdims ;
5959 var ctor ;
6060 var sh ;
61+ var ns ;
6162
6263 // Verify that we were successfully able to create a multi-slice:
6364 if ( slice === null ) {
@@ -76,17 +77,17 @@ function sliceView( target, property, receiver, slice ) {
7677 throw new RangeError ( format ( 'invalid operation. Number of array dimensions does not match the number of slice dimensions. Array shape: (%s). Slice dimensions: %u.' , shape . join ( ',' ) , slice . ndims ) ) ;
7778 }
7879 // Normalize the slice object based on the array shape:
79- slice = normalizeMultiSlice ( slice , shape , true ) ;
80+ ns = normalizeMultiSlice ( slice , shape , true ) ;
8081
8182 // In strict mode, if the slice exceeds array bounds, raise an exception...
82- if ( slice . code && strict ) {
83+ if ( ns . code && strict ) {
8384 throw new RangeError ( format ( 'invalid operation. Slice exceeds array bounds. Array shape: (%s).' , shape . join ( ',' ) ) ) ;
8485 }
8586 // Resolve the output array constructor:
8687 ctor = receiver . constructor ;
8788
8889 // Compute the slice shape:
89- sh = sliceShape ( slice ) ;
90+ sh = sliceShape ( ns ) ;
9091
9192 // Resolve the indices of the non-reduced dimensions:
9293 sdims = nonreducedDimensions ( slice ) ;
@@ -96,7 +97,7 @@ function sliceView( target, property, receiver, slice ) {
9697 return empty ( ctor , dtype , take ( sh , sdims ) , order ) ;
9798 }
9899 // Resolve the index offset of the first element:
99- offset = vind2bind ( shape , strides , offset , order , sliceStart ( slice , shape , strides , 0 ) , 'throw' ) ;
100+ offset = vind2bind ( shape , strides , offset , order , sliceStart ( ns , shape , strides , 0 ) , 'throw' ) ;
100101
101102 // Remove reduced dimensions from the slice shape:
102103 sh = take ( sh , sdims ) ;
@@ -106,7 +107,7 @@ function sliceView( target, property, receiver, slice ) {
106107 return new ctor ( dtype , target . data , [ ] , [ 0 ] , offset , order , options ( ) ) ; // eslint-disable-line max-len
107108 }
108109 // Update strides according to slice steps:
109- strides = sliceStrides ( slice , strides , sdims ) ;
110+ strides = sliceStrides ( ns , strides , sdims ) ;
110111
111112 // Return a slice view:
112113 return new ctor ( dtype , target . data , sh , strides , offset , order , options ( ) ) ; // eslint-disable-line max-len
0 commit comments