Returns an iterator which transforms iterated values from two iterators by applying the iterated values as arguments to a provided function.
When invoked, the callback function is provided 3
arguments:
value0
: iterated value from first iteratorvalue1
: iterated value from second iteratorindex
: iteration index (zero-based)The length of the returned iterator is equal to the length of the shortest provided iterator. In other words, the returned iterator ends once one of the provided iterators ends.
If an environment supports Symbol.iterator
and all provided iterators are iterable, the returned iterator is iterable.
first iterator
second iterator
callback function which transforms an iterated value
execution context
iterator
var array2iterator = require( `@stdlib/array/to-iterator` );
function transform( x, y ) {
return x + y;
}
var it1 = array2iterator( [ 1.0, 2.0 ] );
var it2 = array2iterator( [ 3.0, 4.0 ] );
var iter = iterMapN( it1, it2, transform );
var v = iter.next().value;
// returns 4.0
v = iter.next().value;
// returns 6.0
var bool = iter.next().done;
// returns true
Returns an iterator which transforms iterated values from three iterators by applying the iterated values as arguments to a provided function.
When invoked, the callback function is provided 4
arguments:
value0
: iterated value from first iteratorvalue1
: iterated value from second iteratorvalue2
: iterated value from third iteratorindex
: iteration index (zero-based)The length of the returned iterator is equal to the length of the shortest provided iterator. In other words, the returned iterator ends once one of the provided iterators ends.
If an environment supports Symbol.iterator
and all provided iterators are iterable, the returned iterator is iterable.
first iterator
second iterator
third iterator
callback function which transforms an iterated value
execution context
iterator
var array2iterator = require( `@stdlib/array/to-iterator` );
function transform( x, y, z ) {
return x + y + z;
}
var it1 = array2iterator( [ 1.0, 2.0 ] );
var it2 = array2iterator( [ 3.0, 4.0 ] );
var it3 = array2iterator( [ 5.0, 6.0 ] );
var iter = iterMapN( it1, it2, it3, transform );
var v = iter.next().value;
// returns 9.0
v = iter.next().value;
// returns 12.0
var bool = iter.next().done;
// returns true
Returns an iterator which transforms iterated values from four iterators by applying the iterated values as arguments to a provided function.
When invoked, the callback function is provided 5
arguments:
value0
: iterated value from first iteratorvalue1
: iterated value from second iteratorvalue2
: iterated value from third iteratorvalue3
: iterated value from fourth iteratorindex
: iteration index (zero-based)The length of the returned iterator is equal to the length of the shortest provided iterator. In other words, the returned iterator ends once one of the provided iterators ends.
If an environment supports Symbol.iterator
and all provided iterators are iterable, the returned iterator is iterable.
first iterator
second iterator
third iterator
fourth iterator
callback function which transforms an iterated value
execution context
iterator
var array2iterator = require( `@stdlib/array/to-iterator` );
function transform( x, y, z, w ) {
return x + y + z + w;
}
var it1 = array2iterator( [ 1.0, 2.0 ] );
var it2 = array2iterator( [ 3.0, 4.0 ] );
var it3 = array2iterator( [ 5.0, 6.0 ] );
var it4 = array2iterator( [ 7.0, 8.0 ] );
var iter = iterMapN( it1, it2, it3, it4, transform );
var v = iter.next().value;
// returns 16.0
v = iter.next().value;
// returns 20.0
var bool = iter.next().done;
// returns true
Returns an iterator which transforms iterated values from five iterators by applying the iterated values as arguments to a provided function.
When invoked, the callback function is provided 6
arguments:
value0
: iterated value from first iteratorvalue1
: iterated value from second iteratorvalue2
: iterated value from third iteratorvalue3
: iterated value from fourth iteratorvalue4
: iterated value from fifth iteratorindex
: iteration index (zero-based)The length of the returned iterator is equal to the length of the shortest provided iterator. In other words, the returned iterator ends once one of the provided iterators ends.
If an environment supports Symbol.iterator
and all provided iterators are iterable, the returned iterator is iterable.
first iterator
second iterator
third iterator
fourth iterator
fifth iterator
callback function which transforms an iterated value
execution context
iterator
var array2iterator = require( `@stdlib/array/to-iterator` );
function transform( x, y, z, w, v ) {
return x + y + z + w + v;
}
var it1 = array2iterator( [ 1.0, 2.0 ] );
var it2 = array2iterator( [ 3.0, 4.0 ] );
var it3 = array2iterator( [ 5.0, 6.0 ] );
var it4 = array2iterator( [ 7.0, 8.0 ] );
var it5 = array2iterator( [ 9.0, 10.0 ] );
var iter = iterMapN( it1, it2, it3, it4, it5, transform );
var v = iter.next().value;
// returns 25.0
v = iter.next().value;
// returns 30.0
var bool = iter.next().done;
// returns true
Returns an iterator which transforms iterated values from two or more iterators by applying the iterated values as arguments to a provided function.
When invoked, the callback function is provided N+1
arguments, where N
is the number of provided iterators and the last argument is the iteration index:
...value
: iterated valuesindex
: iteration index (zero-based)The length of the returned iterator is equal to the length of the shortest provided iterator. In other words, the returned iterator ends once one of the provided iterators ends.
If an environment supports Symbol.iterator
and all provided iterators are iterable, the returned iterator is iterable.
first iterator
second iterator
subsequent iterators, a callback function which transforms an iterated value, and an optional execution context
iterator
var array2iterator = require( `@stdlib/array/to-iterator` );
function transform( x, y ) {
return x + y;
}
var it1 = array2iterator( [ 1.0, 2.0 ] );
var it2 = array2iterator( [ 3.0, 4.0 ] );
var iter = iterMapN( it1, it2, transform );
var v = iter.next().value;
// returns 4.0
v = iter.next().value;
// returns 6.0
var bool = iter.next().done;
// returns true
Callback function which transforms iterated values.
iterated values and the iteration index
callback result