git ssb

0+

cel / pull-kvdiff



Branch:
cel committed 0.0.1Latest: d35136e on 6/3/2017, 10:00:36 PM
📄README.md
📄index.js
📄package.json
📄test.js
README.md

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.

Built with git-ssb-web