2.0.0 • Published 8 years ago

@justinc/map-all v2.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 years ago

map-all NPM version License Js Standard Style

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

ParamType
mappersIterable.<Mapper>
iterableIterable.<*>

@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

ParamTypeDescription
currentValueXThe current element being processed in the array.
indexnumberThe index of the current element being processed in the array.
arrayArray.<X>The array map was called upon.

Example

const appendIndex = (x, i) => x + `${i}`
;[1, 2, 3].map(appendIndex)
// gives: ['10', '21', '32']