2025-04-01 16:15:20 +02:00
|
|
|
import React from 'react'
|
|
|
|
import { diffWords, diffJson } from 'diff'
|
|
|
|
import ReactDiffViewer from 'react-diff-viewer-continued'
|
|
|
|
|
2025-05-25 16:29:57 +02:00
|
|
|
/**
|
|
|
|
* A method to diff JSON content
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @param {object} from - Once side of the diff
|
|
|
|
* @param {object} to - Other side of the diff
|
|
|
|
* @returns {object}
|
|
|
|
*/
|
2025-04-01 16:15:20 +02:00
|
|
|
export const diffJSON = (from, to) => diffJson(from, to)
|
2025-05-25 16:29:57 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A method to diff string content
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @param {string} from - Once side of the diff
|
|
|
|
* @param {string} to - Other side of the diff
|
|
|
|
* @returns {object}
|
|
|
|
*/
|
2025-04-01 16:15:20 +02:00
|
|
|
export const diffCheck = (from, to) => diffWords(from, to)
|
|
|
|
|
|
|
|
export const DiffViewer = (props) => <ReactDiffViewer {...props} />
|