1.1.1 • Published 5 years ago

@ianwalter/compare v1.1.1

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
5 years ago

@ianwalter/compare

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

npm page

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