highland-zip-map

    2.0.1 • Public • Published

    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 }

    Keywords

    none

    Install

    npm i highland-zip-map

    DownloadsWeekly Downloads

    1

    Version

    2.0.1

    License

    MIT

    Last publish

    Collaborators

    • protometa