2.0.1 • Published 7 years ago

highland-zip-map v2.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

Usage

For highland 2 use version 1.

Takes a mapping of keys to streams and returns a stream of zipped values mapped by the original keys:

const _ = require('highland');
const zipMap = require('highland-zip-map');

_([
  ['a', _([1,2])],
  ['b', _([3,4])]
]).through(zipMap);
// => [['a', 1], ['b', 3]], [['a', 2], ['b', 4]]

// using objects
_.pairs({
  a: _([1,2]),
  b: _([3,4])
}).through(zipMap)
.map(pairsToObject); // pairsToObject sold separately
// => {a: 1, b: 3}, {a: 2, b: 4}

// using Maps
_(new Map([
  ['a', _([1, 2])],
  ['b', _([3, 4])]
]))
.through(zipMap)
.map((pairs) => new Map(pairs));
// => Map { 'a' => 1, 'b' => 3 }, Map { 'a' => 2, 'b' => 4 }
2.0.1

7 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago