1 | export function simpleDiffString(a: string, b: string): SimpleDiff<string>;
|
2 | export function simpleDiff(a: string, b: string): SimpleDiff<string>;
|
3 | export function simpleDiffArray<T>(a: T[], b: T[], compare?: ((arg0: T, arg1: T) => boolean) | undefined): SimpleDiff<T[]>;
|
4 | export function simpleDiffStringWithCursor(a: string, b: string, cursor: number): {
|
5 | index: number;
|
6 | remove: number;
|
7 | insert: string;
|
8 | };
|
9 | /**
|
10 | * A SimpleDiff describes a change on a String.
|
11 | *
|
12 | * ```js
|
13 | * console.log(a) // the old value
|
14 | * console.log(b) // the updated value
|
15 | * // Apply changes of diff (pseudocode)
|
16 | * a.remove(diff.index, diff.remove) // Remove `diff.remove` characters
|
17 | * a.insert(diff.index, diff.insert) // Insert `diff.insert`
|
18 | * a === b // values match
|
19 | * ```
|
20 | */
|
21 | export type SimpleDiff<T> = {
|
22 | /**
|
23 | * The index where changes were applied
|
24 | */
|
25 | index: number;
|
26 | /**
|
27 | * The number of characters to delete starting
|
28 | * at `index`.
|
29 | */
|
30 | remove: number;
|
31 | /**
|
32 | * The new text to insert at `index` after applying
|
33 | * `delete`
|
34 | */
|
35 | insert: T;
|
36 | };
|
37 | //# sourceMappingURL=diff.d.ts.map |
\ | No newline at end of file |