-
-
Notifications
You must be signed in to change notification settings - Fork 310
Expand file tree
/
Copy pathcompute-lines.d.ts
More file actions
51 lines (51 loc) · 1.61 KB
/
compute-lines.d.ts
File metadata and controls
51 lines (51 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
export declare enum DiffType {
DEFAULT = 0,
ADDED = 1,
REMOVED = 2
}
export declare enum DiffMethod {
CHARS = "diffChars",
WORDS = "diffWords",
WORDS_WITH_SPACE = "diffWordsWithSpace",
LINES = "diffLines",
TRIMMED_LINES = "diffTrimmedLines",
SENTENCES = "diffSentences",
CSS = "diffCss"
}
export interface DiffInformation {
value?: string | DiffInformation[];
lineNumber?: number;
type?: DiffType;
}
export interface LineInformation {
left?: DiffInformation;
right?: DiffInformation;
}
export interface ComputedLineInformation {
lineInformation: LineInformation[];
diffLines: number[];
}
export interface ComputedDiffInformation {
left?: DiffInformation[];
right?: DiffInformation[];
}
export interface JsDiffChangeObject {
added?: boolean;
removed?: boolean;
value?: string;
}
/**
* [TODO]: Think about moving common left and right value assignment to a
* common place. Better readability?
*
* Computes line wise information based in the js diff information passed. Each
* line contains information about left and right section. Left side denotes
* deletion and right side denotes addition.
*
* @param oldString Old string to compare.
* @param newString New string to compare with old string.
* @param disableWordDiff Flag to enable/disable word diff.
* @param compareMethod JsDiff text diff method from https://github.com/kpdecker/jsdiff/tree/v4.0.1#api
*/
declare const computeLineInformation: (oldString: string, newString: string, disableWordDiff?: boolean, compareMethod?: string) => ComputedLineInformation;
export { computeLineInformation };