QueueGenerator
A queue generator type.
Extends
Generator
<T
,void
>
Type Parameters
• T
The element type.
Methods
[dispose]()
Call Signature
[dispose]():
void
Returns
void
Inherited from
Generator.[dispose]
Call Signature
[dispose]():
void
Returns
void
Inherited from
Generator.[dispose]
[iterator]()
[iterator]():
Generator
<T
,void
>
Returns
Generator
<T
, void
>
Inherited from
Generator.[iterator]
drop()
drop(
count
):IteratorObject
<T
,undefined
>
Creates an iterator whose values are the values from this iterator after skipping the provided count.
Parameters
count
number
The number of values to drop.
Returns
IteratorObject
<T
, undefined
>
Inherited from
Generator.drop
enqueue()
enqueue(…
xs
):void
Enqueue new values into the queue.
Parameters
xs
…Iterable
<T
>[]
The values to enqueue.
Returns
void
every()
every(
predicate
):boolean
Determines whether all the members of this iterator satisfy the specified test.
Parameters
predicate
(value
, index
) => unknown
A function that accepts up to two arguments. The every method calls the predicate function for each element in this iterator until the predicate returns false, or until the end of this iterator.
Returns
boolean
Inherited from
Generator.every
filter()
Call Signature
filter<
S
>(predicate
):IteratorObject
<S
,undefined
>
Creates an iterator whose values are those from this iterator for which the provided predicate returns true.
Type Parameters
• S
Parameters
predicate
(value
, index
) => value is S
A function that accepts up to two arguments to be used to test values from the underlying iterator.
Returns
IteratorObject
<S
, undefined
>
Inherited from
Generator.filter
Call Signature
filter(
predicate
):IteratorObject
<T
,undefined
>
Creates an iterator whose values are those from this iterator for which the provided predicate returns true.
Parameters
predicate
(value
, index
) => unknown
A function that accepts up to two arguments to be used to test values from the underlying iterator.
Returns
IteratorObject
<T
, undefined
>
Inherited from
Generator.filter
find()
Call Signature
find<
S
>(predicate
):undefined
|S
Returns the value of the first element in this iterator where predicate is true, and undefined otherwise.
Type Parameters
• S
Parameters
predicate
(value
, index
) => value is S
find calls predicate once for each element of this iterator, in order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.
Returns
undefined
| S
Inherited from
Generator.find
Call Signature
find(
predicate
):undefined
|T
Parameters
predicate
(value
, index
) => unknown
Returns
undefined
| T
Inherited from
Generator.find
flatMap()
flatMap<
U
>(callback
):IteratorObject
<U
,undefined
>
Creates an iterator whose values are the result of applying the callback to the values from this iterator and then flattening the resulting iterators or iterables.
Type Parameters
• U
Parameters
callback
(value
, index
) => Iterator
<U
, unknown
, undefined
> | Iterable
<U
, unknown
, undefined
>
A function that accepts up to two arguments to be used to transform values from the underlying iterator into new iterators or iterables to be flattened into the result.
Returns
IteratorObject
<U
, undefined
>
Inherited from
Generator.flatMap
forEach()
forEach(
callbackfn
):void
Performs the specified action for each element in the iterator.
Parameters
callbackfn
(value
, index
) => void
A function that accepts up to two arguments. forEach calls the callbackfn function one time for each element in the iterator.
Returns
void
Inherited from
Generator.forEach
map()
map<
U
>(callbackfn
):IteratorObject
<U
,undefined
>
Creates an iterator whose values are the result of applying the callback to the values from this iterator.
Type Parameters
• U
Parameters
callbackfn
(value
, index
) => U
A function that accepts up to two arguments to be used to transform values from the underlying iterator.
Returns
IteratorObject
<U
, undefined
>
Inherited from
Generator.map
next()
next(…
__namedParameters
):IteratorResult
<T
,void
>
Parameters
__namedParameters
[] | [any
]
Returns
IteratorResult
<T
, void
>
Inherited from
Generator.next
reduce()
Call Signature
reduce(
callbackfn
):T
Calls the specified callback function for all the elements in this iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
Parameters
callbackfn
(previousValue
, currentValue
, currentIndex
) => T
A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the iterator.
Returns
T
Inherited from
Generator.reduce
Call Signature
reduce(
callbackfn
,initialValue
):T
Parameters
callbackfn
(previousValue
, currentValue
, currentIndex
) => T
initialValue
T
Returns
T
Inherited from
Generator.reduce
Call Signature
reduce<
U
>(callbackfn
,initialValue
):U
Calls the specified callback function for all the elements in this iterator. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
Type Parameters
• U
Parameters
callbackfn
(previousValue
, currentValue
, currentIndex
) => U
A function that accepts up to three arguments. The reduce method calls the callbackfn function one time for each element in the iterator.
initialValue
U
If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of a value from the iterator.
Returns
U
Inherited from
Generator.reduce
return()
return(
value
):IteratorResult
<T
,void
>
Parameters
value
void
Returns
IteratorResult
<T
, void
>
Inherited from
Generator.return
some()
some(
predicate
):boolean
Determines whether the specified callback function returns true for any element of this iterator.
Parameters
predicate
(value
, index
) => unknown
A function that accepts up to two arguments. The some method calls the predicate function for each element in this iterator until the predicate returns a value true, or until the end of the iterator.
Returns
boolean
Inherited from
Generator.some
take()
take(
limit
):IteratorObject
<T
,undefined
>
Creates an iterator whose values are the values from this iterator, stopping once the provided limit is reached.
Parameters
limit
number
The maximum number of values to yield.
Returns
IteratorObject
<T
, undefined
>
Inherited from
Generator.take
throw()
throw(
e
):IteratorResult
<T
,void
>
Parameters
e
any
Returns
IteratorResult
<T
, void
>
Inherited from
Generator.throw
toArray()
toArray():
T
[]
Creates a new array from the values yielded by this iterator.
Returns
T
[]
Inherited from
Generator.toArray
Properties
[toStringTag]
readonly
[toStringTag]:string
Inherited from
Generator.[toStringTag]