@ali-tas/htmldiff-js
Version:
JavaScript port of HtmlDiff.Net which is itself a C# port of HtmlDiff
40 lines (33 loc) • 950 B
TypeScript
type Action = 'equal' | 'delete' | 'insert' | 'none' | 'replace';
type DiffOptions = {
repeatingWordsAccuracy?: number;
ignoreWhiteSpaceDifferences?: boolean;
orphanMatchThreshold?: number;
matchGranularity?: number;
combineWords?: boolean;
};
declare function execute(oldText: string, newText: string, options?: DiffOptions): string;
declare const Diff: {
execute: typeof execute;
};
type Match = {
startInOld: number;
startInNew: number;
endInOld: number;
endInNew: number;
size: number;
};
type MatchOptions = {
blockSize: number;
repeatingWordsAccuracy: number;
ignoreWhiteSpaceDifferences: boolean;
};
type Mode = 'character' | 'tag' | 'whitespace' | 'entity';
type Operation = {
action: Action;
startInOld: number;
endInOld: number;
startInNew: number;
endInNew: number;
};
export { type Action, Diff, type Match, type MatchOptions, type Mode, type Operation };