A State object that can emit or consume changes in JSON-PATCH format
$ npm run build
$ node
> SR = require('./dist/state-recorder').default
[Function: StateRecorder]
> var state = new SR()
undefined
> state.set('keyA', 'a')
undefined
> state.set('keyA', 'A')
undefined
> var patches = state.getReversePatches()
undefined
> patches
[ { op: 'remove', path: 'keyA' },
{ op: 'replace', path: 'keyA', value: 'a' } ]
> state.get('keyA')
'A'
> state.applyPatch(patches[1])
undefined
> state.get('keyA')
'a'
> state.applyPatch(patches[0])
undefined
> state.has('keyA')
false
> state.getPatches()
[ [ { op: 'remove', path: 'keyA' },
{ op: 'add', path: 'keyA', value: 'a' } ],
[ { op: 'replace', path: 'keyA', value: 'a' },
{ op: 'replace', path: 'keyA', value: 'A' } ],
[ { op: 'replace', path: 'keyA', value: 'A' },
{ op: 'replace', path: 'keyA', value: 'a' } ],
[ { op: 'add', path: 'keyA', value: 'a' },
{ op: 'remove', path: 'keyA' } ] ]