compare

A utility to calculate the match percentage and diff between two JavaScript objects

OTHER License

Downloads
20
Stars
3
Committers
2

@ianwalter/compare

A utility to calculate the match percentage and diff between two JavaScript objects

Installation

yarn add @ianwalter/compare

Usage

const compare = require('@ianwalter/compare')

const lhs = { a: 1, b: 2 }
const rhs = { a: 1, b: 3 }
const result = compare(lhs, rhs) // => {
//   match: 75,
//   diff: [{ kind: 'E', path: [ 'b' ], lhs: 2, rhs: 3 }]
// }

License

Apache 2.0 with Commons Clause - See LICENSE

 

Created by Ian Walter

Package Rankings
Top 17.93% on Npmjs.org
Badges
Extracted from project README
npm page
Related Projects