JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 4505
  • Score
    100M100P100Q137370F
  • License MIT

render JSON differences with custom your styles

Package Exports

    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

    ts version download-badge license test coverage ๅฎ˜็ฝ‘

    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/

    demo

    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)

    License

    MIT