Function
| Static Public Summary | ||
| public |
first(iterable: Iterable): any Returns the first value of the input iterable. |
|
| public |
last(iterable: Iterable): any Returns the last value of the input iterable. |
|
| public |
Returns the |
|
Static Public
public first(iterable: Iterable): any source
import first from '@iterable-iterator/select/src/first.js'Returns the first value of the input iterable. If the iterable is exhausted, throws a StopIteration.
Params:
| Name | Type | Attribute | Description |
| iterable | Iterable | The input iterable. |
Return:
| any | The first value of the input iterable. |
public last(iterable: Iterable): any source
import last from '@iterable-iterator/select/src/last.js'Returns the last value of the input iterable. If the iterable is exhausted, throws a StopIteration.
Params:
| Name | Type | Attribute | Description |
| iterable | Iterable | The input iterable. |
Return:
| any | The last value of the input iterable. |
public nth(iterable: Iterable, n: number): any source
import nth from '@iterable-iterator/select/src/nth.js'Returns the nth value of the input iterable (n
is a 0-based index). If
n is negative, returns the nth value from the
end.
If no such value exists, throws a StopIteration.
Params:
| Name | Type | Attribute | Description |
| iterable | Iterable | The input iterable. |
|
| n | number | The index of the value to output. |
Return:
| any | The |
Example:
// returns 3
nth( range( 5 ) , 3 ) ;
