Callback function which returns the next stride.
Callback function which returns the next stride.
Callback function which returns the next stride.
Callback function which returns the next stride.
Callback function which returns the next stride.
Returns an iterator which steps according to a callback function.
When invoked, the callback function is provided four arguments:
value
: iterated valuei
: input iteration index (zero-based)n
: output (strided) iteration index (zero-based)curr
: current strideIf an environment supports Symbol.iterator
and a provided iterator is iterable, the returned iterator is iterable.
input iterator
callback function which returns the next stride
offset
boolean indicating whether to eagerly advance an input iterator when provided a non-zero offset
(default: false)
execution context
iterator
var array2iterator = require( `@stdlib/array/to-iterator` );
var arr = array2iterator( [ 0, 1, 2, 3, 4, 5, 6, 7 ] );
function stride( v, i ) {
return (i % 10) + 1;
}
var iter = iterStridedBy( arr, stride, 1, true );
var r = iter.next().value;
// returns 1
r = iter.next().value;
// returns 2
r = iter.next().value;
// returns 4
// ...
Returns an iterator which steps according to a callback function.
When invoked, the callback function is provided four arguments:
value
: iterated valuei
: input iteration index (zero-based)n
: output (strided) iteration index (zero-based)curr
: current strideIf an environment supports Symbol.iterator
and a provided iterator is iterable, the returned iterator is iterable.
input iterator
callback function which returns the next stride
offset
execution context
iterator
var array2iterator = require( `@stdlib/array/to-iterator` );
var arr = array2iterator( [ 0, 1, 2, 3, 4, 5, 6, 7 ] );
function stride( v, i ) {
return (i % 10) + 1;
}
var iter = iterStridedBy( arr, stride, 1 );
var r = iter.next().value;
// returns 1
r = iter.next().value;
// returns 2
r = iter.next().value;
// returns 4
// ...
Returns an iterator which steps according to a callback function.
When invoked, the callback function is provided four arguments:
value
: iterated valuei
: input iteration index (zero-based)n
: output (strided) iteration index (zero-based)curr
: current strideIf an environment supports Symbol.iterator
and a provided iterator is iterable, the returned iterator is iterable.
input iterator
callback function which returns the next stride
execution context
iterator
var array2iterator = require( `@stdlib/array/to-iterator` );
var arr = array2iterator( [ 0, 1, 2, 3, 4, 5, 6, 7 ] );
function stride( v, i ) {
return (i % 10) + 1;
}
var iter = iterStridedBy( arr, stride, null );
var r = iter.next().value;
// returns 0
r = iter.next().value;
// returns 1
r = iter.next().value;
// returns 2
// ...
Callback function which returns the next stride.
iterated value
input iteration index
callback result