Herm document system
This module allow you to create a "git like" sync system for documents in JS with automatic conflict resolution. With this module, you can edit multiple instances of the same document and merge them in a queue, the module will solve the conflict by itself.
Installation
You can either use it via NPM (for Node or bundled modules)
npm install herm-js-document
or via ES6 modules
<script type="module"> ; let doc = ;</script>
Usage
For plain text :
let doc = ;doc; let doc2 = doc; doc;doc2; console; // doc1 : Hello worldconsole; // doc2 : Hello ! doc = doc; // first merge console; // doc(first merge) : Hello world ! doc2;console; // doc2(updated) : Hello ?! doc = doc; // no duplicates, even with outdated documents console; // doc(merged with outdated) : Hello world ?! doc; console; // doc(merged with outdated) : world ?!
For JSON :
let docJson = ;docJsonkey = "123";console // {key: "123"} let docJson2 = docJson;docJson2key = "5";docJson2key2 = "7"; docJson = docJson; console // {key: "5", key2: "7"}