1
0
Fork 0
freesewing/packages/react/components/DiffViewer/index.mjs

26 lines
658 B
JavaScript
Raw Normal View History

import React from 'react'
import { diffWords, diffJson } from 'diff'
import ReactDiffViewer from 'react-diff-viewer-continued'
/**
* 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}
*/
export const diffJSON = (from, to) => diffJson(from, to)
/**
* 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}
*/
export const diffCheck = (from, to) => diffWords(from, to)
export const DiffViewer = (props) => <ReactDiffViewer {...props} />