Package Exports
- diff-viz
- diff-viz/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (diff-viz) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
diff-viz
render JSON differences and custom your styles
Install
two choices:
# react component, easy to start
npm install react-diff-viz
# function, flexible and extendable
npm install diff-viz
Demo And Usage
https://littlewhite-hai.github.io/diff-viz/
Features
- ๐ Precise diff detection between complex JSON objects
- โก Efficient array alignment using LCS (Longest Common Subsequence) algorithm
- ๐ Support for nested arrays and objects with any level of complexity
- ๐จ Customizable styling of diff results
- ๐งช Well-tested with comprehensive test cases
Test Coverage
The library is thoroughly tested to ensure reliability and correctness:
File | % Statements | % Branches | % Functions | % Lines |
---|---|---|---|---|
diff-algorithm.ts | 97.24% | 94.19% | 100% | 97.24% |
Test Scenarios
We test various scenarios to ensure robust diff detection:
- โ Simple object differences
- โ Nested object structures
- โ Array handling with different alignment strategies
- โ Multi-dimensional arrays
- โ Special value comparisons (null, undefined, dates)
- โ Custom equality functions
- โ Data2-based array alignment (preserving second array structure)