File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change 11import * as diff from 'diff' ;
22
3+ const jsDiff : { [ key : string ] : any } = diff ;
4+
35export enum DiffType {
46 DEFAULT = 0 ,
57 ADDED = 1 ,
@@ -17,6 +19,8 @@ export enum DiffMethod {
1719}
1820
1921export interface DiffInformation {
22+ added ?: boolean ;
23+ removed ?: boolean ;
2024 value ?: string | DiffInformation [ ] ;
2125 lineNumber ?: number ;
2226 type ?: DiffType ;
@@ -77,13 +81,13 @@ const constructLines = (value: string): string[] => {
7781 * @param jsDiffCompareMethod JsDiff text diff method from https://github.com/kpdecker/jsdiff/tree/v4.0.1#api
7882 */
7983const computeDiff = ( oldValue : string , newValue : string , jsDiffCompareMethod : string ) : ComputedDiffInformation => {
80- const diffArray = diff [ jsDiffCompareMethod ] ( oldValue , newValue ) ;
84+ const diffArray = jsDiff [ jsDiffCompareMethod ] ( oldValue , newValue ) ;
8185 const computedDiff : ComputedDiffInformation = {
8286 left : [ ] ,
8387 right : [ ] ,
8488 } ;
8589 diffArray
86- . forEach ( ( { added, removed, value } ) : DiffInformation => {
90+ . forEach ( ( { added, removed, value } : DiffInformation ) : DiffInformation => {
8791 const diffInformation : DiffInformation = { } ;
8892 if ( added ) {
8993 diffInformation . type = DiffType . ADDED ;
You can’t perform that action at this time.
0 commit comments