Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const DiffView = ({
oldText,
newText,
className,
viewType,
patch,
markEditsByWord,
emptyState,
markThreshold,
markLongDistanceDiff,
...props
}) => {
const markEditProps = { markThreshold, markLongDistanceDiff };
const markEdits = markEditsByWord ? markWordEdits(markEditProps) : markCharacterEdits(markEditProps);
const classes = classNames('diff-pf', className);
// Old, New Text
if (!patch) {
const gitDiff = getDiff(oldText, newText);
const files = parseDiff(gitDiff);
const hunk = files[0].hunks;
if (hunk.length === 0) {
return emptyState;
}
return hunk && ;
}
// Patch
const files = parseDiff(patch);