diff-utils

0.0.1 • Public • Published

diff-utils

Simple utility functions that give you diffs of objects or arrays with unique strings:

Diffing objects:

var before = {key1: 1, key2: 2}
var after = {key1: 2, key3: 4}
var diff = findDiff.dictionary(before, after)
// returns:
{modified: ['key1'], added: ['key3'], deleted: ['key2']}

Diffing arrays (must have unique strings as elements):

var before = ['1','2','3','4']
var after = ['2','1','5']
var diff = findDiff.set(before, after)
// returns:
{added: ['5'], deleted: ['3', '4']}

Readme

Keywords

none

Package Sidebar

Install

npm i diff-utils

Weekly Downloads

0

Version

0.0.1

License

BSD

Last publish

Collaborators

  • mirkok