This is a WebAssembly wrapper around the diff-match-patch-rs library. It is intended to be used in the browser.
npm install diff-match-patch-wasm
import { Differ } from 'diff-match-patch-wasm';
const dmp = new Differ();
const diffs = dmp.diff_main('Hello, world!', 'Goodbye, world!');
console.log(diffs);
To build the WebAssembly module, run:
wasm-pack build
To run the tests, run:
wasm-pack test --chrome --headless