Callback function which both filters and maps.
Callback function which both filters and maps.
Callback function which both filters and maps.
Returns an iterator which both filters and maps a provided iterator's values.
When invoked, the callback function is provided two arguments:
value
: iterated valueindex
: iteration index (zero-based)If the callback returns undefined
, the iterator invokes the function for the next value of the provided iterator; otherwise, the iterator returns the callback's return value.
If an environment supports Symbol.iterator
and a provided iterator is iterable, the returned iterator is iterable.
input iterator
callback function which both filters and maps
execution context
iterator
var array2iterator = require( `@stdlib/array/to-iterator` );
function fcn( v ) {
if ( v > 2 ) {
return v * 10;
}
}
var src = array2iterator( [ 1, 3, 2, 4 ] );
var iter = iterFilterMap( src, fcn );
var v = iter.next().value;
// returns 30
v = iter.next().value;
// returns 40
var bool = iter.next().done;
// returns true
Callback function which both filters and maps.
iterated value
iteration index
filter result