Complete implementation of RFC6902 (patch and diff)
No fancy Object.observe, no TypeScript, no missing "diff" function.
Simple web app using the browser-compiled version of the code.
If you've ever implemented Levenshtein's algorithm,
or played tricks with
git stash to get a reasonable sequence of commits,
you'll realize that computing diffs is rarely deterministic.
(This explains why 2 out of the 94 tests are currently failing.)
json-patch documents is way easier than generating them,
which might explain why there are more than five patch-applying RFC6902 implementations in NPM,
but only one (yours truly) that attempts to generate patch documents from two distinct objects.
So when comparing your data objects, you'll want to ensure that the patches it generates meet your needs.
Of course, this only applies to generating the patches. Applying them is deterministic and completely specified by RFC6902.
npm install rfc6902
git clone https://github.com/chbrown/rfc6902.gitcd rfc6902npm install -g
var rfc6902 = require'rfc6902';
Copyright © 2014 Christopher Brown. MIT Licensed.