Skip to content
This repository has been archived by the owner on Nov 26, 2021. It is now read-only.

Latest commit

 

History

History
53 lines (42 loc) · 1.63 KB

README.md

File metadata and controls

53 lines (42 loc) · 1.63 KB

redis-diff

Last version Build Status Coverage Status Dependency status Dev Dependencies Status NPM Status Donate

Perform a difference comparison backed by redis.

Install

$ npm install redis-diff --save

Usage

const diff = createDiff()
const noop = () => {}

diff.set({
  key: 'mykey',
  value: [
    { id: 1, foo: 'bar' },
    { id: 1, foo: 'barz' },
    { id: 1, foo: 'baaz' }
  ]
}, noop)

diff.compare({
  key: 'mykey',
  value: [
    { id: 1, foo: 'bar' },
    { id: 1, foo: 'baarz' },
    { id: 1, foo: 'bax' }
  ],
  ids: ['id', 'foo']
}, console.log)

// {
//   added: [ { id: 1, foo: 'baarz' }, { id: 1, foo: 'bax' } ],
//   removed: [ { id: 1, foo: 'barz' }, { id: 1, foo: 'baaz' } ],
//   common: [ { id: 1, foo: 'bar' } ]
// }

License

MIT © Kiko Beats.