1.0.2 • Published 4 years ago

diff-match-patch-js-browser-and-nodejs v1.0.2

Weekly downloads
415
License
Apache-2.0
Repository
github
Last release
4 years ago

diff-match-patch-js-browser-and-nodejs

npm package (browser and nodejs) for https://github.com/google/diff-match-patch/tree/master/javascript

When importing the JS file from npm pacakge https://www.npmjs.com/package/diff-match-patch in a browser, it gives error: "Uncaught ReferenceError: module is not defined at index.js:2186", this motivated me to develop this package.

Installation

npm install diff-match-patch-js-browser-and-nodejs

API

Source

Instructions

diff_match_uncompressed.js is the human-readable version. This should be used by developers and Node.js.

diff_match_patch.js has been compressed using Google's Closure Compiler on 'simple' mode. This reduces the size to 25% of the uncompressed version.

The JavaScript version has no dependencies. It works in Netscape 4, Internet Explorer 5.5, and all browsers released since the year 2000 (the limiting factor is the use of the encodeURI function).

Tests Unit tests can be performed by pointing a web browser at javascript/tests/diff_match_patch_test.html. Over a hundred tests should run, with zero failures.

Speed test for diff can be performed by pointing a web browser at javascript/tests/speedtest.html and pressing "Compute Diff".

Usage (Browser)

Hello World Here's a minimal example of a diff in JavaScript:

Usage (NodeJs)

To be done

License

http://www.apache.org/licenses/LICENSE-2.0