Skip to content

ianwalter/compare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

@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

About

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

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published