26
26
* Class containing the diff, match and patch methods.
27
27
* @constructor
28
28
*/
29
- var diff_match_patch = function ( ) {
29
+ export const diff_match_patch = function ( ) {
30
30
31
31
// Defaults.
32
32
// Redefine these in your program to override the defaults.
@@ -62,9 +62,9 @@ var diff_match_patch = function() {
62
62
* [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
63
63
* which means: delete 'Hello', add 'Goodbye' and keep ' world.'
64
64
*/
65
- var DIFF_DELETE = - 1 ;
66
- var DIFF_INSERT = 1 ;
67
- var DIFF_EQUAL = 0 ;
65
+ export const DIFF_DELETE = - 1 ;
66
+ export const DIFF_INSERT = 1 ;
67
+ export const DIFF_EQUAL = 0 ;
68
68
69
69
/**
70
70
* Class representing one diff tuple.
@@ -90,12 +90,12 @@ diff_match_patch.Diff.prototype.toString = function() {
90
90
91
91
/**
92
92
* Provide an iterable instance on a Diff object.
93
- *
93
+ *
94
94
* While it's not intended that the Diff be iterated,
95
95
* this instance is useful for destructuring assignment.
96
- *
96
+ *
97
97
* Example:
98
- *
98
+ *
99
99
* const diff = new diff_match_patch.Diff(DIFF_EQUAL, 'hello');
100
100
* const [op, text] = diff;
101
101
*/
@@ -1223,7 +1223,7 @@ diff_match_patch.prototype.diff_cleanupMerge = function(diffs) {
1223
1223
1224
1224
/**
1225
1225
* Rearrange diff boundaries that split Unicode surrogate pairs.
1226
- *
1226
+ *
1227
1227
* @param {!Array.<!diff_match_patch.Diff> } diffs Array of diff tuples.
1228
1228
*/
1229
1229
diff_match_patch . prototype . diff_cleanupSplitSurrogates = function ( diffs ) {
@@ -1290,17 +1290,17 @@ diff_match_patch.prototype.digit16 = function(c) {
1290
1290
1291
1291
/**
1292
1292
* Decode URI-encoded string but allow for encoded surrogate halves
1293
- *
1293
+ *
1294
1294
* diff_match_patch needs this relaxation of the requirements because
1295
1295
* not all libraries and versions produce valid URI strings in toDelta
1296
1296
* and we don't want to crash this code when the input is valid input
1297
1297
* but at the same time invalid utf-8
1298
- *
1298
+ *
1299
1299
* @example : decodeURI( 'abcd%3A %F0%9F%85%B0' ) = 'abcd: \ud83c\udd70'
1300
1300
* @example : decodeURI( 'abcd%3A %ED%A0%BC' ) = 'abcd: \ud83c'
1301
- *
1301
+ *
1302
1302
* @cite : @mathiasbynens utf8.js at https://github.com/mathiasbynens/utf8.js
1303
- *
1303
+ *
1304
1304
* @param {String } text input string encoded by encodeURI() or equivalent
1305
1305
* @return {String }
1306
1306
*/
@@ -2408,20 +2408,4 @@ diff_match_patch.patch_obj.prototype.toString = function() {
2408
2408
text [ x + 1 ] = op + encodeURI ( this . diffs [ x ] [ 1 ] ) + '\n' ;
2409
2409
}
2410
2410
return text . join ( '' ) . replace ( / % 2 0 / g, ' ' ) ;
2411
- } ;
2412
-
2413
- // CLOSURE:begin_strip
2414
- // Lines below here will not be included in the Closure-compatible library.
2415
-
2416
- // Export these global variables so that they survive Google's JS compiler.
2417
- // In a browser, 'this' will be 'window'.
2418
- // Users of node.js should 'require' the uncompressed version since Google's
2419
- // JS compiler may break the following exports for non-browser environments.
2420
- /** @suppress {globalThis} */
2421
- this [ 'diff_match_patch' ] = diff_match_patch ;
2422
- /** @suppress {globalThis} */
2423
- this [ 'DIFF_DELETE' ] = DIFF_DELETE ;
2424
- /** @suppress {globalThis} */
2425
- this [ 'DIFF_INSERT' ] = DIFF_INSERT ;
2426
- /** @suppress {globalThis} */
2427
- this [ 'DIFF_EQUAL' ] = DIFF_EQUAL ;
2411
+ } ;
0 commit comments