jsdifflist's People
jsdifflist's Issues
Add ability to descend into analogous objects/arrays
What I would like to see is something like this:
Input:
jsdifff({
a: [ 1, 2, 3 ],
b: { "cool, spaces": { x: 1, y: 3, z: 5 }, foo: 'bar' },
}, {
a: [ 1, 3, 3 ],
b: { "cool, spaces": { x: 1, z: 3 } },
}).toString();
Output:
Property Equality Object A Object B
---------------------- --------- ------------- ---------------
a unequal Array Array
a[0] equal 1 1
a[1] unequal 2 3
a[2] equal 3 3
b unequal Object Object
b["cool, spaces"] unequal Object Object
b["cool, spaces"].x equal 1 1
b["cool, spaces"].y unequal 3 undefined
b["cool, spaces"].z unequal 5 3
Possibly indent subproperties? Could get long/messy, but something like this:
Property Equality Object A Object B
------------------------- --------- ------------ ------------
a unequal Array Array
a[0] equal 1 1
a[1] unequal 2 3
a[2] equal 3 3
b unequal Object Object
b["cool, spaces"] unequal Object Object
b["cool, spaces"].x equal 1 1
b["cool, spaces"].y unequal 3 undefined
b["cool, spaces"].z unequal 5 3
Less "noisy" colors
Green for strictly equal values seems sensible at first blush, but it calls unnecessary attention to the strictly equal values, which are usually the least interesting. Suggest making strictly equal values appear in normal text color.
`toString` output lists `undefined` instead of indexes
for jsdifff([1, 2, 3], [1, 3, 3])
output is:
Property Equality Object A Object B
--------- -------- -------- --------
undefined strict 1 1
undefined unequal 2 3
undefined strict 3 3
Add option to only show differing value (perhaps by equality type?)
It is usually uninteresting to see values that are strictly equal, and sometimes to see values that are conceptually/loosely equal. Perhaps something like this:
Input:
jsdiff([1, 2, 3], [1, 3, "3"], { hide: 'strict' });
Output:
Property Equality Object A Object B
---------------------- --------- ------------- ---------------
1 unequal 2 3
2 loose 3 "3"
(1 strictly equal value(s) omitted)
Input:
jsdiff([1, 2, 3], [1, 3, "3"], { hide: 'strict, loose' });
Output:
Property Equality Object A Object B
---------------------- --------- ------------- ---------------
1 unequal 2 3
(1 strictly and 1 loosely equal value(s) omitted)
Truncate/wrap long strings
Currently long strings aren't capped, and it screws up the table generation. For example:
Property Equality Object A Object B
-------------- -------- --------------------------------------------------------
----------------------------------------------------------------------------------
---------------- ----------------------------------------------------------------
----------------------------------------------------------------------------------
--------
userId strict "" ""
depth strict 3 3
name strict "Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Curabitur ac eros tortor. Aliquam nec ornare sem. Aliquam quis vestibulum
leo. Nulla sed sodales arcu, a rutrum eros. Sed ut leo risus. Nullam et tortor
fringilla turpis facilisis condimentum. Nam eu est dui. Integer a molestie mauris.
Sed quis arcu quam. Quisque ullamcorper, massa in dignissim commodo, massa ipsum
semper lacus, ac commodo enim metus in nisi. Nunc hendrerit augue nunc, at
iaculis elit ullamcorper eu."
Would be better if it were truncated or had reasonable line breaks (or an option for both?).
Add ability to change labels `Object A` and `Object B` to `Actual` and `Expected`
That would be a handy default...maybe a way to make them custom labels as well.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.