Skip to content

Commit 0aed067

Browse files
committed
feat: add support for accessor strided arrays
1 parent aa364a0 commit 0aed067

File tree

1 file changed

+11
-1
lines changed
  • lib/node_modules/@stdlib/array/base/from-strided/lib

1 file changed

+11
-1
lines changed

lib/node_modules/@stdlib/array/base/from-strided/lib/main.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@
1818

1919
'use strict';
2020

21+
// MODULES //
22+
23+
var resolveGetter = require( '@stdlib/array/base/resolve-getter' );
24+
25+
2126
// MAIN //
2227

2328
/**
@@ -41,13 +46,18 @@
4146
*/
4247
function strided2array( N, x, stride, offset ) {
4348
var out;
49+
var get;
4450
var ix;
4551
var i;
4652

53+
// Resolve an accessor function for retrieving array elements:
54+
get = resolveGetter( x );
55+
56+
// Copy strided elements to a dense non-strided array...
4757
ix = offset;
4858
out = [];
4959
for ( i = 0; i < N; i++ ) {
50-
out.push( x[ ix ] );
60+
out.push( get( x, ix ) );
5161
ix += stride;
5262
}
5363
return out;

0 commit comments

Comments
 (0)