ai-map v1.2.0
ai-map
Map over async iterables
The map() function creates a new async iterable with the results of calling a provided function on every element in the async iterable.
This module is part of Async iterable fun, a complete toolset of modules to work with async iterables.
Usage
description of the example
import aiMap from 'ai-map';
for (const item of {aiMap}()) {
yield item;
};This will output
API
index
Creates a new async iterable with the results of calling a provided function on every element in the async iterable.
Parameters
dataAsyncIterable The async iterable to map overtransformFunction Function to apply to each element in the async iterable, taking 3 arguments: . `currentValue - The current element being processed in the async iterable.__currentIndex__ - The index of the current element being processed in the async iterable. Starts at index 0 __data__ - The async iterable map was called upon. ```
Returns AyncIterable An iterable that iterates over the transform calls results.
with
Higher order function that partially apply transform to the
map function.
Parameters
transformFunction The transform argument to partially apply to map
Returns Function A map unary function that take a data argument
and return a new async iterable.
Install
With npm installed, run
npm install --save ai-mapSee Also
License
MIT Licensed © 2017 Andrea Parodi