Function
Static Public Summary | ||
public |
Applies a given callable to each of the elements of the input iterable. |
|
public |
Yields some of the properties of the input object. |
|
public |
Same as map but allows multiple arguments callable functions. |
Static Public
public * map(callable: Function, iterable: Iterable): IterableIterator source
import map from '@iterable-iterator/map/src/map.js'
Applies a given callable to each of the elements of the input iterable.
Params:
Name | Type | Attribute | Description |
callable | Function | The callable to use. |
|
iterable | Iterable | The input iterable. |
Return:
IterableIterator |
Example:
// return [ 0 , 1 , 4 , 9 ]
list( map( x => x**2 , range( 4 ) ) ) ;
public * pick(object: Object, iterable: Iterable): IterableIterator source
import pick from '@iterable-iterator/map/src/pick.js'
Yields some of the properties of the input object. The properties to yield are designated by the input iterable.
Params:
Name | Type | Attribute | Description |
object | Object | The input object. |
|
iterable | Iterable | The input iterable. |
Return:
IterableIterator |
Example:
// returns [ 'a' , 'e' , 'c' ]
list( pick( 'abcde' , [ 0 , 4 , 2 ] ) ) ;
public * starmap(callable: Function, iterable: Iterable): Iterator source
import starmap from '@iterable-iterator/map/src/starmap.js'
Same as map but allows multiple arguments callable functions.
Params:
Name | Type | Attribute | Description |
callable | Function | The callable to use. |
|
iterable | Iterable | The input iterable. |
Return:
Iterator |
Example:
// return [ 0 , 1 , 4 , 9 ]
list( starmap( ( x , y ) => x*y , zip( range( 4 ) , range( 4 ) ) ) ;