mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
17 lines
403 B
TypeScript
17 lines
403 B
TypeScript
import fastDiff = require('fast-diff');
|
|
|
|
let diffs: fastDiff.Diff[];
|
|
diffs = fastDiff("hi there", "hi");
|
|
diffs = fastDiff("hi there", "hi", 1);
|
|
|
|
diffs.forEach((diff: fastDiff.Diff) => {
|
|
const operation: number = diff[0];
|
|
const text: string = diff[1];
|
|
|
|
switch (diff[0]) {
|
|
case fastDiff.EQUAL: break;
|
|
case fastDiff.DELETE: break;
|
|
case fastDiff.INSERT: break;
|
|
}
|
|
});
|