@ianwalter/compare

1.1.1 • Public • Published

@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

Package Sidebar

Install

npm i @ianwalter/compare

Weekly Downloads

2

Version

1.1.1

License

SEE LICENSE IN LICENSE

Unpacked Size

8.59 kB

Total Files

10

Last publish

Collaborators

  • ianwalter