{"id":21893308,"url":"https://github.com/henoc/diffsonjs","last_synced_at":"2026-04-14T06:04:15.627Z","repository":{"id":94339059,"uuid":"164461199","full_name":"henoc/diffsonjs","owner":"henoc","description":"A json diff/patch implementation of the RFC-6902","archived":false,"fork":false,"pushed_at":"2019-01-16T11:05:24.000Z","size":42,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-20T07:03:21.330Z","etag":null,"topics":["diff","javascript","json","json-patch","patch"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/henoc.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-07T16:37:56.000Z","updated_at":"2019-01-17T04:20:59.000Z","dependencies_parsed_at":"2023-04-07T11:24:53.868Z","dependency_job_id":null,"html_url":"https://github.com/henoc/diffsonjs","commit_stats":{"total_commits":12,"total_committers":2,"mean_commits":6.0,"dds":0.5,"last_synced_commit":"1b79819f9f873df128509ea9083d33359417572a"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/henoc/diffsonjs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henoc%2Fdiffsonjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henoc%2Fdiffsonjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henoc%2Fdiffsonjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henoc%2Fdiffsonjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/henoc","download_url":"https://codeload.github.com/henoc/diffsonjs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/henoc%2Fdiffsonjs/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262916617,"owners_count":23383885,"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":["diff","javascript","json","json-patch","patch"],"created_at":"2024-11-28T13:13:21.890Z","updated_at":"2026-04-14T06:04:15.599Z","avatar_url":"https://github.com/henoc.png","language":"TypeScript","readme":"# diffsonjs\n\n[![travis_ci](https://img.shields.io/travis/henoc/diffsonjs.svg)](https://travis-ci.org/henoc/diffsonjs)\n[![codecov](https://img.shields.io/codecov/c/github/henoc/diffsonjs.svg)](https://codecov.io/gh/henoc/diffsonjs)\n[![npm](https://img.shields.io/npm/v/diffsonjs.svg)](https://www.npmjs.com/package/diffsonjs)\n\nA javascript JSON diff and patch implementation of the [RFC-6902](https://tools.ietf.org/html/rfc6902). This library refers to [diffson](https://github.com/gnieh/diffson).\n\n## Install\n\n```bash\nnpm install diffsonjs\n```\n\n## Usage\n\n```js\nvar diffsonjs = require('diffsonjs');\n\nvar left = {a: 1, b: true};\nvar right = {a: 2};\n\nvar delta = diffsonjs.diff(left, right);\nconsole.log(delta);\n// [\n//   { op: 'replace', path: '/a', value: 2 },\n//   { op: 'remove', path: '/b' }\n// ]\n\nvar result = diffsonjs.patch(left, delta);\nconsole.log(result);\n// {a: 2}\n```\n\n## API\n\n### diff(json1, json2, options?)\n\nCompute the diff between two json objects.\n\n#### diff options\n\n```ts\ninterface DiffOptions {\n    omitArrayDiffs?: boolean // default false, different arrays are represented by repleacement.\n    remember?: boolean // default false, set the previous value as `oldValue` property for replacement or movement.\n    equals?: (left: unknown, right: unknown) =\u003e boolean // if it exists, use it instead of the normal json comparison function.\n    hashCode?: (value: any) =\u003e number // if it exists, it is used to speed up comparison of arrays.\n}\n```\n\n### patch(json, delta, options?)\n\nApply a patch to json and return the result.\n\n#### patch options\n\n```ts\ninterface PatchOptions {\n    equals?: (left: unknown, right: unknown) =\u003e boolean // if it exists, use it for tests.\n}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenoc%2Fdiffsonjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhenoc%2Fdiffsonjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhenoc%2Fdiffsonjs/lists"}