2.0.0 • Published 9 years ago
@justinc/map-all v2.0.0
map-all

Run multiple map functions against an Iterable in one go.
Install
npm i @justinc/map-all
Example of usage
const mapAll = require('@justinc/map-all')
// `mapAll` is curried in v2 onwards (see curry tutorial)
mapAll([(x) => x + 1, (x) => x + 2])([1, 2, 3])
// [ [2, 3, 4], [3, 4, 5] ]Modules
@justinc/map-all
@justinc/map-all~mapAll(mappers, iterable) ⇒ Array.<Array.<*>>
This function is curried.
Calls each mapper obtained from mappers on each element obtained from iterable.
In the given result, there is an array for each found mapper. The result of mappers0 is at
results0 etc…
Kind: inner method of @justinc/map-all
See: Mapper
| Param | Type |
|---|---|
| mappers | Iterable.<Mapper> |
| iterable | Iterable.<*> |
@justinc/jsdocs
This module houses JSDoc 3 type definitions which can be re-used in different packages.
@justinc/jsdocs.Mapper ⇒ Array.<Y>
A function of type Mapper is a similar function to what you'd pass to Array.map
Kind: static typedef of @justinc/jsdocs
Template: X,Y
| Param | Type | Description |
|---|---|---|
| currentValue | X | The current element being processed in the array. |
| index | number | The index of the current element being processed in the array. |
| array | Array.<X> | The array map was called upon. |
Example
const appendIndex = (x, i) => x + `${i}`
;[1, 2, 3].map(appendIndex)
// gives: ['10', '21', '32']