-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdisparity.d.ts
109 lines (102 loc) · 2.41 KB
/
disparity.d.ts
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
export interface Options {
/**
* How many lines to display before/after a line that contains diffs
*
* @default 3
*/
context?: number;
/**
* File paths displayed just before the diff
*
* @default [disparity.removed, disparity.added]
*/
paths?: [string, string];
}
/**
* Diffs two blocks of text, comparing character by character
* and returning a string with ansi color codes.
*
* Will return an empty string if `oldStr` equals `newStr`.
*
* @example ```
* var diff = disparity.chars(file1, file2);
* console.log(diff);
* ```
*
* @param {string} oldStr
* @param {string} newStr
* @param {Options} opts
*
* @return {string}
*/
export function chars(oldStr: string, newStr: string, opts: Options): string;
/**
* Returns ansi colorized {@link https://en.wikipedia.org/wiki/Diff_utility#Unified_format unified diff}.
*
* Will return an empty string if `oldStr` equals `newStr`.
*
* @example ```
* var diff = disparity.unified(file1, file2, {
* paths: ['test/file1.js', 'test/file2.js']
* });
* console.log(diff);
* ```
*
* @param {string} oldStr
* @param {string} newStr
* @param {Options} opts
*
* @return {string}
*/
export function unified(oldStr: string, newStr: string, opts: Options): string;
/**
* Returns ansi colorized {@link https://en.wikipedia.org/wiki/Diff_utility#Unified_format unified diff}.
* Useful for terminals that {@link https://www.npmjs.com/package/supports-color don't support color}.
*
* Will return an empty string if `oldStr` equals `newStr`.
*
* @example ```
* var diff = disparity.unifiedNoColor(file1, file2, {
* paths: ['test/file1.js', 'test/file2.js']
* });
* console.log(diff);
* ```
*
* @param {string} oldStr
* @param {string} newStr
* @param {Options} opts
*
* @return {string}
*/
export function unifiedNoColor(
oldStr: string,
newStr: string,
opts: Options
): string;
/**
* The string used on diff headers to say that chars/lines were removed
*
* @default 'removed'
*/
export let removed: string;
/**
* The string used on the diff headers to say that chars/lines were added
*
* @default 'added'
*/
export let added: string;
export interface DiffColor {
open: string;
close: string;
}
/**
* Object containing references to all the colors used by disparity.
*/
export let colors: {
added: DiffColor;
charsAdded: DiffColor;
charsRemoved: DiffColor;
header: DiffColor;
removed: DiffColor;
section: DiffColor;
};