0.0.1 • Published 7 years ago

pull-kvdiff v0.0.1

Weekly downloads
3
License
Fair
Repository
-
Last release
7 years ago

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.