Methods
chain(…functions) → {function}
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
functions |
function |
<repeatable> |
- Source:
Returns:
a function that applies each provided function in order
- Type
- function
count(source) → {number}
Parameters:
| Name | Type | Description |
|---|---|---|
source |
Iterable.<T> | The iterable to count |
- Source:
Returns:
The number of elements in the source
- Type
- number
distinct(source) → {Operator.<T, T>}
An operator that only returns values from the source iterable once
Parameters:
| Name | Type | Description |
|---|---|---|
source |
the source iterable |
- Source:
Returns:
- Type
- Operator.<T, T>
filter(predicate) → {Operator.<T, T>}
A function that produces an operator that does not emit any elements that do not satisfy the predicate
Parameters:
| Name | Type | Description |
|---|---|---|
predicate |
Predicate.<T> | determines if a value from the source iterable will be in the output Iterable |
- Source:
Returns:
a new filter operation that uses predicate
- Type
- Operator.<T, T>
find(predicate) → {Aggregator.<T, T>}
Parameters:
| Name | Type | Description |
|---|---|---|
predicate |
Predicate.<T> | A Predicate function to check values against |
- Source:
Returns:
An aggregator that returns the first value in an iterable that satisfies the predicate
- Type
- Aggregator.<T, T>
limit(amountToTake) → {Operator.<T, T>}
A function that produces an Operator that limits the number of values emitted
Parameters:
| Name | Type | Description |
|---|---|---|
amountToTake |
number | the maximum number of values that should be emitted |
- Source:
Returns:
an Operation that will only yield upto count values
- Type
- Operator.<T, T>
map(mapper) → {Operator.<T, U>}
Parameters:
| Name | Type | Description |
|---|---|---|
mapper |
Mapper.<T, U> |
- Source:
Returns:
a new map operation that uses mapper
- Type
- Operator.<T, U>
sort(comparator) → {Operator.<T, T>}
Cannot be used with infinite collections, it will cause an infinite loop.
Is not entirely lazily evaluated, all values are pulled from source
immediately but are sorted only as requested.
Parameters:
| Name | Type | Description |
|---|---|---|
comparator |
Comparator.<T> |
- Source:
Returns:
an Operator that emits values from source in
the order of largest to smallest using comparator.
- Type
- Operator.<T, T>
takeWhile(predicate) → {Operator.<T, T>}
Parameters:
| Name | Type | Description |
|---|---|---|
predicate |
Predicate.<T> |
- Source:
Returns:
an Operator that will emit values until a value in the source iterable does not fulfill the predicate
- Type
- Operator.<T, T>
Type Definitions
Aggregator(source) → {U}
A function that takes an iterable and aggregates it to create a single result.
Cannot be used with infinite collections, it will cause an infinite loop.
Parameters:
| Name | Type | Description |
|---|---|---|
source |
Iterable.<T> | an iterable to be aggregated |
Returns:
a single value that is the result of aggregating a source iterable
- Type
- U
Comparator(first, second) → {number}
A function that compares two arguments
Parameters:
| Name | Type | Description |
|---|---|---|
first |
T | |
second |
T |
Returns:
a negative number if the first argument is smaller,
zero if both arguments are equal, or a positive number if the
first argument is larger than the second
- Type
- number
Mapper(value) → {U}
Parameters:
| Name | Type | Description |
|---|---|---|
value |
T | the input value to be mapped |
Returns:
the result of the mapping
- Type
- U
Operator(source) → {Iterable.<U>}
A function that takes an Iterable and produces a Iterable that that returns values after an operation has been applied the values in the source iterable
Parameters:
| Name | Type | Description |
|---|---|---|
source |
Iterable.<T> | the source iterable to be operated on |
Returns:
the values from the source after the operation has been applied
- Type
- Iterable.<U>
Predicate(value) → {boolean}
A function that takes a value and determines a true of false status for the value
Parameters:
| Name | Type | Description |
|---|---|---|
value |
T | to be evaluated |
Returns:
whether or not the provided value satisfies the criteria
- Type
- boolean