omgaz / diffler Goto Github PK
View Code? Open in Web Editor NEWA recursive JSON comparison script for humans
License: MIT License
A recursive JSON comparison script for humans
License: MIT License
Allow .init
to accept an object.
Write test coverage for TestFactory nested JSON.
Not really a bug I suppose but where you have two arrays in an object that are identical but in a different order diffler sees these as totally different arrays.
const obj1 = {
myArray: [
{ foo: 'bar' },
{ baz: 'bat' }
]
}
const obj2 = {
myArray: [
{ baz: 'bat' },
{ foo: 'bar' }
]
}
const diff = diffler(obj1, obj2)
console.log(JSON.stringify(diff))
gives
{"myArray":{"0":{"foo":{"from":"bar","to":null},"baz":{"from":null,"to":"bat"}},"1":{"baz":{"from":"bat","to":null},"foo":{"from":null,"to":"bar"}}}}
so would be nice to have an option to ignore ordering in arrays
but even if you accept that the order does matter I am not sure how 'human readable' this output is? But I am sure this is pretty complex stuff I wouldn't like to try ;-)
This library seems to fill a gap I am searching for this kind of tool to compare changes between json objects.
differ?
see what's on npm
Calculate levenstein distances for each comparison object.
Implement test coverage for main JS Diff
Automatically fix styling and readability issues in the code and align code base to common best practices.
Due to the recursive nature of diffler if an array contains objects and strings, for example, when the recursion is called obj1 would be an object, but obj2 would be a string. Therefore key in obj2
would fail.
To resolve this, we'd need to check array types
Lower kbs, means faster downloads, less bandwidth, smaller footprint
Would be nice to have some methods to provide intelligent analysis of the diff object.
Code hasn't been changed in ~5 years, could do with removing some complexity.
diffler function has a complexity of 19, it has many branches as well as recursion.
Depends upon #11
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.