We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aa364a0 commit 0aed067Copy full SHA for 0aed067
lib/node_modules/@stdlib/array/base/from-strided/lib/main.js
@@ -18,6 +18,11 @@
18
19
'use strict';
20
21
+// MODULES //
22
+
23
+var resolveGetter = require( '@stdlib/array/base/resolve-getter' );
24
25
26
// MAIN //
27
28
/**
@@ -41,13 +46,18 @@
41
46
*/
42
47
function strided2array( N, x, stride, offset ) {
43
48
var out;
49
+ var get;
44
50
var ix;
45
51
var i;
52
53
+ // Resolve an accessor function for retrieving array elements:
54
+ get = resolveGetter( x );
55
56
+ // Copy strided elements to a dense non-strided array...
57
ix = offset;
58
out = [];
59
for ( i = 0; i < N; i++ ) {
- out.push( x[ ix ] );
60
+ out.push( get( x, ix ) );
61
ix += stride;
62
}
63
return out;
0 commit comments