$ npm install @metarhia/iterator
- Iterator
- Iterator.range
- Iterator.zip
- Iterator.prototype.constructor
- Iterator.prototype.apply
- Iterator.prototype.chain
- Iterator.prototype.chainApply
- Iterator.prototype.collectTo
- Iterator.prototype.collectWith
- Iterator.prototype.count
- Iterator.prototype.each
- Iterator.prototype.enumerate
- Iterator.prototype.every
- Iterator.prototype.filter
- Iterator.prototype.filterMap
- Iterator.prototype.find
- Iterator.prototype.findCompare
- Iterator.prototype.flat
- Iterator.prototype.flatMap
- Iterator.prototype.forEach
- Iterator.prototype.groupBy
- Iterator.prototype.includes
- Iterator.prototype.join
- Iterator.prototype.map
- Iterator.prototype.max
- Iterator.prototype.min
- Iterator.prototype.next
- Iterator.prototype.partition
- Iterator.prototype.reduce
- Iterator.prototype.skip
- Iterator.prototype.skipWhile
- Iterator.prototype.some
- Iterator.prototype.someCount
- Iterator.prototype.take
- Iterator.prototype.takeWhile
- Iterator.prototype.toArray
- Iterator.prototype.toObject
- Iterator.prototype.zip
- iter
- iterEntries
- iterKeys
- iterValues
- AsyncIterator
- AsyncIterator.prototype.constructor
- AsyncIterator.prototype.chain
- AsyncIterator.prototype.collectTo
- AsyncIterator.prototype.collectWith
- AsyncIterator.prototype.count
- AsyncIterator.prototype.each
- AsyncIterator.prototype.enumerate
- AsyncIterator.prototype.every
- AsyncIterator.prototype.filter
- AsyncIterator.prototype.find
- AsyncIterator.prototype.flat
- AsyncIterator.prototype.flatMap
- AsyncIterator.prototype.forEach
- AsyncIterator.prototype.includes
- AsyncIterator.prototype.join
- AsyncIterator.prototype.map
- AsyncIterator.prototype.next
- AsyncIterator.prototype.parallel
- AsyncIterator.prototype.reduce
- AsyncIterator.prototype.skip
- AsyncIterator.prototype.some
- AsyncIterator.prototype.someCount
- AsyncIterator.prototype.take
- AsyncIterator.prototype.takeWhile
- AsyncIterator.prototype.throttle
- AsyncIterator.prototype.toArray
- AsyncIterator.prototype.zip
- asyncIter
Returns: <Iterator>
Create iterator iterating over the range
iterators
:<Array>
Returns: <Iterator>
Create iterator by zipping multiple provided iterators into one
fn
:<Function>
this
:<Iterator>
Returns: the result of fn(this)
call.
Call a function with this
. Will be equivalent to calling fn(it)
.
fn
:<Function>
this
:<Iterator>
Returns: <Iterator>
result of fn(this)
wrapped in an Iterator.
Call a function with this
and wrap the result in an Iterator.
Example:
iter([1, 2])
.chainApply(([a, b]) => [a + b, a - b])
.join(', ');
Result:
'3, -1';
mapper
:<Function>
function that maps values and returns either new value that will be the next value of the new iterator orfilterValue
that will be ignored.value
:<any>
iterator element
thisArg
:<any>
value to be used asthis
when callingmapper
filterValue
:<any>
value to filter outmapper
results.
Creates an iterator that both filters and maps with the passed mapper
.
This iterator will call mapper
on each element and if mapper returns NOT
filterValue
it will be returned, otherwise it is ignored.
comparator
:<Function>
returnstrue
if new value should be acceptedcurrValue
:<any>
current value, starts with undefinednextValue
:<any>
next value- Returns:
<boolean>
true
if next value should be accepted
accessor
:<Function>
gets value to compare by, current iterator value is used by defaultvalue
:<any>
current iterator value- Returns:
<any>
value to compare by
thisArg
:<any>
value to be used asthis
when callingaccessor
andcomparator
Returns: last iterator value where comparator
returned true
,
<undefined>
by default
Find value in this iterator by comparing every value with
the found one using comparator
classifier
:<Function>
gets value to group byvalue
:<any>
current iterator value- Returns:
<any>
value to group by
thisArg
:<any>
value to be used asthis
when callingclassifier
- Returns:
<Map>
map with arrays of iterator values grouped by keys returned byclassifier
Consumes an iterator grouping values by keys
accessor
:<Function>
gets value to compare by, current iterator value is used by defaultvalue
:<any>
current iterator value- Returns:
<any>
value to compare by
thisArg
:<any>
value to be used asthis
when callingaccessor
Returns: element with maximum value or <undefined>
if iterator
is empty
Find the maximum value in this iterator
accessor
:<Function>
gets value to compare by, current iterator value is used by defaultvalue
:<any>
current iterator value- Returns:
<any>
value to compare by
thisArg
:<any>
value to be used asthis
when callingaccessor
Returns: element with minimum value or <undefined>
if iterator
is empty
Find the minimum value in this iterator
predicate
:<Function>
function returns a value to partition this iteratorthisArg
:<any>
value to be used asthis
when callingpredicate
- Returns:
<Array>
array of partitions (arrays), will always have at least 2 arrays in it
Consumes an iterator, partitioning it into Arrays
Transforms an iterator of key-value pairs into an object.
This is similar to what {Object.fromEntries()}
would offer.
base
:<Iterable>
|<AsyncIterable>
an iterable that is wrapped in<AsyncIterator>
Returns: <AsyncIterator>
Create an AsyncIterator instance
See github for full contributors list