map-indexed-xf

1.1.0 • Public • Published

map-indexed-xf

GitHub license npm version CircleCI Status Greenkeeper badge

This module defines a function that returns a transducer which calls a given function with each value and its index. This transducer may be used with Javascript transducer libraries such as jlongster/transducers.js and cognitect-labs/transducers-js.

Example

const t = require('transducers.js');
const mapIndexed = require('map-indexed-xf');
 
const result = t.toArray([5,6,7], t.compose(
  t.map(x => x*10),
  mapIndexed((x, i) => [i, x])
));
 
console.log(result); // [[0, 50], [1, 60], [2, 70]]

Types

TypeScript type definitions for this module are included! The type definitions won't require any configuration to use.

Package Sidebar

Install

npm i map-indexed-xf

Weekly Downloads

61

Version

1.1.0

License

MIT

Unpacked Size

7.88 kB

Total Files

10

Last publish

Collaborators

  • macil