pull-kvdiff

0.0.1 • Public • Published

pull-kvdiff

diff key-value streams

var pull = require('pull-stream')
var kvdiff = require('pull-kvdiff')

pull(
  kvdiff([
    pull.values([
      {key: 'a', value: 1},
      {key: 'b', value: 2},
      {key: 'c', value: 3},
    ]),
    pull.values([
      {key: 'a', value: 1},
      {key: 'b', value: 3},
      {key: 'd', value: 3},
    ])
  ], 'key'),
  pull.log()
)

output:

{ key: 'b',
  values: [ { key: 'b', value: 2 }, { key: 'b', value: 3 } ],
  diff: { value: [ 2, 3 ] } }
{ key: 'c',
  values: [ { key: 'c', value: 3 },  ],
  diff: { key: [ 'c' ], value: [ 3 ] } }
{ key: 'd',
  values: [ , { key: 'd', value: 3 } ],
  diff: { key: [ , 'd' ], value: [ , 3 ] } }

kvdiff(sources, keyProp) → source

License

Copyright (c) 2016 Charles Lehner

Usage of the works is permitted provided that this instrument is retained with the works, so that any entity that uses the works is notified of this instrument.

DISCLAIMER: THE WORKS ARE WITHOUT WARRANTY.

Readme

Keywords

none

Package Sidebar

Install

npm i pull-kvdiff

Weekly Downloads

3

Version

0.0.1

License

Fair

Last publish

Collaborators

  • cel