{"id":13525875,"url":"https://github.com/kbadk/json0-ot-diff","last_synced_at":"2025-04-01T06:30:39.546Z","repository":{"id":9499619,"uuid":"62326463","full_name":"kbadk/json0-ot-diff","owner":"kbadk","description":"Finds differences between two JSON object and generates operational transformation (OT) operations for transforming the first object into the second according to the JSON0 OT Type.","archived":false,"fork":false,"pushed_at":"2023-01-01T11:13:49.000Z","size":44,"stargazers_count":133,"open_issues_count":5,"forks_count":16,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-02T16:16:03.367Z","etag":null,"topics":["collaborative-editing","javascript","json","json0","operational-transformation","operational-transformations","ot"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kbadk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-30T16:31:00.000Z","updated_at":"2025-02-20T11:21:31.000Z","dependencies_parsed_at":"2023-01-11T20:12:29.528Z","dependency_job_id":null,"html_url":"https://github.com/kbadk/json0-ot-diff","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbadk%2Fjson0-ot-diff","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbadk%2Fjson0-ot-diff/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbadk%2Fjson0-ot-diff/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kbadk%2Fjson0-ot-diff/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kbadk","download_url":"https://codeload.github.com/kbadk/json0-ot-diff/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246596548,"owners_count":20802844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["collaborative-editing","javascript","json","json0","operational-transformation","operational-transformations","ot"],"created_at":"2024-08-01T06:01:23.056Z","updated_at":"2025-04-01T06:30:39.223Z","avatar_url":"https://github.com/kbadk.png","language":"JavaScript","readme":"# JSON0 OT Diff\n\nFinds differences between two JSON object and generates operational transformation (OT) operations for transforming the first object into the second according to the [JSON0 OT Type](https://github.com/ottypes/json0).\n\nThe current implementation supports list/object insertion/deletion (i.e. `li`, `ld`, `oi`, `od`) out of the box.\n\n\tvar jsondiff = require(\"./json0-ot-diff\");\n\n\tvar diff = jsondiff(\n\t\t[\"foo\", \"bar\", 1, 2, 3],\n\t\t[\"foo\", \"quux\", 1, 2]\n\t);\n\tconsole.log(diff);\n\n\t\u003e [\n\t\u003e\t{ p: [ 1 ], ld: 'bar', li: 'quux' },\n\t\u003e\t{ p: [ 4 ], ld: 3 }\n\t\u003e]\n\nString insertion/deletion (i.e. `si`, `sd`) operations are generated for string mutations if you provide a reference to [diff-match-patch](https://github.com/google/diff-match-patch).\n\n\tvar diffMatchPatch = require(\"diff-match-patch\");\n\tvar diff = jsondiff(\n\t\t[\"foo\", \"The only change here is at the end.\", 1, 2, 3],\n\t\t[\"foo\", \"The only change here is at the very end.\", 1, 2],\n\t\tdiffMatchPatch\n\t);\n\tconsole.log(diff);\n\n\t\u003e [\n\t\u003e { p: [ 1, 31 ], si: 'very ' },\n\t\u003e { p: [ 4 ], ld: 3 }\n\t\u003e]\n\nThe [JSON1 OT Type](https://github.com/ottypes/json1) is supported as well. To generate ops for the JSON1 OT type, provide a reference to [diff-match-patch](https://github.com/google/diff-match-patch), [ot-json1](https://github.com/ottypes/json1) and [ot-text-unicode](https://github.com/ottypes/text-unicode).\n\n\tvar diffMatchPatch = require(\"diff-match-patch\");\n\tvar json1 = require(\"ot-json1\");\n\tvar textUnicode = require(\"ot-text-unicode\");\n\tvar diff = jsondiff(\n\t\t[\"foo\", \"The only change here is at the end.\", 1, 2, 3],\n\t\t[\"foo\", \"The only change here is at the very end.\", 1, 2],\n\t\tdiffMatchPatch,\n\t\tjson1,\n\t\ttextUnicode\n\t);\n\tconsole.log(diff);\n\n\t\u003e[\n\t\u003e  [ 1, { \"es\": [ 31, \"very \" ] } ],\n\t\u003e  [ 4, { \"r\": true } ]\n\t\u003e]\n\nThis was developed for [JsonML](http://www.jsonml.org/) with [Webstrates](https://github.com/cklokmose/Webstrates) in mind, but could be applicable in other situations.\n","funding_links":[],"categories":["Repository","Project","OT协同"],"sub_categories":["Text/String","运行器e2e测试"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkbadk%2Fjson0-ot-diff","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkbadk%2Fjson0-ot-diff","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkbadk%2Fjson0-ot-diff/lists"}