Skip to content

Commit e3cdf5d

Browse files
authored
Merge pull request #3 from feedyou-ai/setup-npm-pkg
Make js version usable as npm pkg
2 parents 41b7996 + 4fc32c9 commit e3cdf5d

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

javascript/diff_match_patch_uncompressed.js

+5-15
Original file line numberDiff line numberDiff line change
@@ -2407,18 +2407,8 @@ diff_match_patch.patch_obj.prototype.toString = function() {
24072407
return text.join('').replace(/%20/g, ' ');
24082408
};
24092409

2410-
// CLOSURE:begin_strip
2411-
// Lines below here will not be included in the Closure-compatible library.
2412-
2413-
// Export these global variables so that they survive Google's JS compiler.
2414-
// In a browser, 'this' will be 'window'.
2415-
// Users of node.js should 'require' the uncompressed version since Google's
2416-
// JS compiler may break the following exports for non-browser environments.
2417-
/** @suppress {globalThis} */
2418-
this['diff_match_patch'] = diff_match_patch;
2419-
/** @suppress {globalThis} */
2420-
this['DIFF_DELETE'] = DIFF_DELETE;
2421-
/** @suppress {globalThis} */
2422-
this['DIFF_INSERT'] = DIFF_INSERT;
2423-
/** @suppress {globalThis} */
2424-
this['DIFF_EQUAL'] = DIFF_EQUAL;
2410+
module.exports = diff_match_patch;
2411+
module.exports['diff_match_patch'] = diff_match_patch;
2412+
module.exports['DIFF_DELETE'] = DIFF_DELETE;
2413+
module.exports['DIFF_INSERT'] = DIFF_INSERT;
2414+
module.exports['DIFF_EQUAL'] = DIFF_EQUAL;

javascript/package.json

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"name": "diff-match-patch",
3+
"version": "1.0.1",
4+
"description": "diff-patch-match fork with fixed surrogate pair processing",
5+
"main": "diff_match_patch_uncompressed.js",
6+
"directories": {
7+
"test": "tests"
8+
},
9+
"scripts": {
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/feedyou-ai/diff-match-patch/tree/master/javascript"
14+
},
15+
"author": "Google inc. (https://github.com/google), modified by https://github.com/dmsnell and https://github.com/feedyou-ai/",
16+
"license": "Apache-2.0"
17+
}

0 commit comments

Comments
 (0)