Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jsondiffpatch-react

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsondiffpatch-react

jsondiffpatch react

  • 1.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

jsondiffpatch-react

  • Originally forked from archived https://github.com/hero-guo/jsondiffpatch-for-react
  • Based on https://github.com/benjamine/jsondiffpatch

1. install

npm install jsondiffpatch-react

2. usage

import React from 'react';
import JsonDiffReact from 'jsondiffpatch-react';

<JsonDiffReact
    right: PropTypes.any,
    left: PropTypes.any,
    show: PropTypes.bool,
    annotated: PropTypes.bool,
    tips: PropTypes.string,
    objectHash: PropTypes.func,
/>

3. component props

  • left (array, object, string)

  • right (array, object, string)

  • show (bool)

    you can show/hide unchanged values

  • annotated (bool)

    This will render the original JSON delta in html, with annotations aside explaining the meaning of each part. This attempts to make the JSON delta format self-explained.

  • tips (string)

    Message that will displayed in case both elements are identical.

  • objectHash (function)

    Will be passed to jsondiffpatch to improve array comparison performance, as described here. Example:

    <JsonDiffReact
      left={left}
      right={right}
      objectHash={(obj: any) =>
        obj.id || obj._id || obj.name || JSON.stringify(obj)
      }
    />
    

Development notes

To publish to NPM, change the version number in package.json and npm publish once complete. Then, go to Github Releases and follow the instructions to publish a new version there too.

Keywords

FAQs

Package last updated on 10 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc