{"name":"just-diff-apply","version":"5.1.0","description":"Apply a diff to an object. Optionally supports jsonPatch protocol","main":"index.js","module":"index.mjs","exports":{".":{"require":"./index.js","default":"./index.mjs"}},"types":"index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1","build":"rollup -c"},"repository":{"type":"git","url":"git+https://github.com/angus-c/just.git"},"keywords":["object","diff","apply","jsonPatch","no-dependencies","just"],"author":{"name":"Angus Croll"},"license":"MIT","bugs":{"url":"https://github.com/angus-c/just/issues"},"gitHead":"392cc2b977ae52df7b2e390e752a9d3cade6c14a","homepage":"https://github.com/angus-c/just#readme","_id":"just-diff-apply@5.1.0","_nodeVersion":"12.22.6","_npmVersion":"8.1.3","dist":{"integrity":"sha512-7mc9gInhkJEXFn4cAV7VxDTWMmJ0Zo+EF9fzUiHdJPSCA4jZAzptrYlIIoBcAFa2Ya6y4a9w5omzCIBP9NH0lg==","shasum":"4a75ba5207b1ce048ff45acb7386edc107014c04","tarball":"http://registry-npm.ywwl.com/just-diff-apply/download/just-diff-apply-5.1.0.tgz","fileCount":9,"unpackedSize":12712,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh7IanCRA9TVsSAnZWagAA6W0QAJ86GTU5jLcZOnlVmKi7\nWda/CrjIvKwaNcLk+niis1EiV91bn3FIO5nGBytlPTiczwJ6zHBvcHhZb1Qo\ntzHldjetpm/kB+sQESdH9lDZvGEMa1ERCzGk6QjADdd4KBYTSlGu+jYsIev+\naKkhbKZv3vwHFEwD3eex+wFn/9m2xlu9Re/g3XHE+humx4jgvud8uxlFs3Kq\nLoG2tezmAHjiuLMcIiJjPSZdL94kOrrPf2Sjf6lsg8Ts8eXCan0jeeRYmemZ\n4/6KwbLbaiCxpjOr8Sr3VsXqW8ExUv+ZpiT9esWT9mDXpcKC7fHIVOHatWN+\nRuQLBsVAKv7UUWooP5n2IrmEzyVCd4bIi9AUdfBcqWGvY53s0VV7J2QzsesO\ninXsT9QLTpD7ZSWFZK+w36Emdz8dPntnIBnUDiJRxCc8Kq7br/5aRiotn/9M\nfo6IXmaMPhUMM75njCAYxGzOypnoPNC4zsYKVBkb7c/sga6PAqGokCJN7vim\nD6Xmv8VAukWpUCinZsOz65rqyZokyOXtbaaI4dCoCbfPfKyu6ui2C64XsOND\nb82wl1OCYiyb9AhYVOLYy67Mg4K1CyvRf6idvpqpG7ySVpwVyV9S5sjzUa1v\nLAUXsQUtrRnD4DOXfe/ffDJy0zyilY2bR7C1eD0razqgUBUCGt1i07NMNxke\nK71y\r\n=RKlq\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHmrNt2prA08XqDSnN89AjEKiu2Hj2R2fdhYDSIvwHZyAiAxBeLgRzWHJUXz6ls5Z5VzLhepSLp6H7nGRLr2uyvxIg=="}],"size":3404,"noattachment":false,"key":"/just-diff-apply/-/just-diff-apply-5.1.0.tgz"},"_npmUser":{"name":"angus-c","email":"anguscroll@gmail.com"},"directories":{},"maintainers":[{"name":"angus-c","email":"anguscroll@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/just-diff-apply_5.1.0_1642890919745_0.8504020299070436"},"_hasShrinkwrap":false,"readme":"<!-- DO NOT EDIT THIS FILE! THIS FILE WAS AUTOGENERATED BY TEMPLATE-MATE -->\n<!-- SEE https://github.com/angus-c/just/blob/master/CONTRIBUTING.md#readme-template -->\n\n## just-diff-apply\n\nPart of a [library](https://anguscroll.com/just) of zero-dependency npm modules that do just do one thing.\nGuilt-free utilities for every occasion.\n\n[`🍦 Try it`](https://anguscroll.com/just/just-diff-apply)\n\n```shell\nnpm install just-diff-apply\n```\n```shell\nyarn add just-diff-apply\n```\n\nApply a diff object to an object. Pass converter to apply a http://jsonpatch.com standard patch\n\n```js\n  import {diffApply} from 'just-diff-apply';\n\n  const obj1 = {a: 3, b: 5};\n  diffApply(obj1,\n    [\n      { \"op\": \"remove\", \"path\": ['b'] },\n      { \"op\": \"replace\", \"path\": ['a'], \"value\": 4 },\n      { \"op\": \"add\", \"path\": ['c'], \"value\": 5 }\n    ]\n  );\n  obj1; // {a: 4, c: 5}\n\n  const obj2 = {a: 3, b: 5};\n  diffApply(obj2,\n    [\n      { \"op\": \"move\", \"from\": ['a'], \"path\": ['c']},\n    ]\n  );\n  obj2; // {b: 5, c: 3}\n\n  // using converter to apply jsPatch standard paths\n  // see http://jsonpatch.com\n  import {diffApply, jsonPatchPathConverter} from 'just-diff-apply'\n  const obj3 = {a: 3, b: 5};\n  diffApply(obj3, [\n    { \"op\": \"remove\", \"path\": '/b' },\n    { \"op\": \"replace\", \"path\": '/a', \"value\": 4 }\n    { \"op\": \"add\", \"path\": '/c', \"value\": 5 }\n  ], jsonPatchPathConverter);\n  obj3; // {a: 4, c: 5}\n\n  // arrays (array key can be string or numeric)\n  const obj4 = {a: 4, b: [1, 2, 3]};\n  diffApply(obj4, [\n    { \"op\": \"replace\", \"path\": ['a'], \"value\": 3 }\n    { \"op\": \"replace\", \"path\": ['b', 2], \"value\": 4 }\n    { \"op\": \"add\", \"path\": ['b', 3], \"value\": 9 }\n  ]);\n  obj4; // {a: 3, b: [1, 2, 4, 9]}\n\n  // nested paths\n  const obj5 = {a: 4, b: {c: 3}};\n  diffApply(obj5, [\n    { \"op\": \"replace\", \"path\": ['a'], \"value\": 5 }\n    { \"op\": \"remove\", \"path\": ['b', 'c']}\n    { \"op\": \"add\", \"path\": ['b', 'd'], \"value\": 4 }\n  ]);\n  obj5; // {a: 5, b: {d: 4}}\n```\n","publish_time":1642890919924,"_cnpm_publish_time":1642890919924,"dist-tags":{"latest":"5.5.0"}}