{"_id":"json-ptr","_rev":"103-d5a76e89e6de6db8c3ccf5d76e45ea29","name":"json-ptr","dist-tags":{"ts":"1.2.1-ts.cf62f17","dependabot-npm-and-yarn-lodash-4-17-19":"1.3.2-dependabot-npm-and-yarn-lodash-4-17-19.7fd4b3e","issue-28-and-30":"2.0.1-issue-28-and-30.f825bd7","issue-36":"2.1.1-issue-36.f2a3959","relative":"2.1.2-relative.f48c5e7","packaging-rollup":"2.2.1-packaging-rollup.7af30ca","older-nodes":"3.0.1-older-nodes.e0918b8","bug-issue-48":"3.0.2-bug-issue-48.6c9db9f","master":"3.0.2-master.50697cc","fix-examples":"3.1.1-fix-examples.80a275d","symbols":"3.1.1-symbols.0e6db58","dependabot-npm-and-yarn-minimist-1-2-6":"3.1.1-dependabot-npm-and-yarn-minimist-1-2-6.98d2cb6","main":"3.1.2-main.1988f05","latest":"3.1.1","dependabot-npm-and-yarn-json5-2-2-3":"3.1.2-dependabot-npm-and-yarn-json5-2-2-3.c209166","dependabot-npm-and-yarn-webpack-5-76-0":"3.1.2-dependabot-npm-and-yarn-webpack-5-76-0.29bfad0"},"versions":{"0.1.0":{"name":"json-ptr","version":"0.1.0","author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@0.1.0","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"dist":{"shasum":"e6d0548e511f28ed50fe961ce27bca4f18c22c06","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-0.1.0.tgz","integrity":"sha512-Ere1K5jSA9TvGac4JXWjZ7uRKap3WqL2LaMNLD32l3Mc5wWmmICqaIQuWQUkPHHOP1Vr6cubCxCiuOMwkPJmaw==","signatures":[{"sig":"MEQCIBGeh8RFVTFZDr91k8aZfs9LSWY7mxsnhOXT80BbX3FiAiBlSnDpp967eUOmd6NbdaRd9EipHbiNLJfRsZrMbF38bA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","scripts":{"test":"mocha -R spec"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"https://github.com/flitbit/json-ptr","type":"git"},"_npmVersion":"1.2.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{"test":"test","example":"examples"},"devDependencies":{"mocha":"~1.10.x","expect.js":"~0.2.x"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.1.1":{"name":"json-ptr","version":"0.1.1","author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@0.1.1","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"dist":{"shasum":"bab82a31e292ce7af9e3fc7fd65acd1bbb9248e8","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-0.1.1.tgz","integrity":"sha512-Id1WlyhEgvSAdFze7CF2pSqriY5C+6VqNuJfIF3LiMXJ0BGuuG/zHNf0toOGT3p2Xl5kyfxm2dFbw8HmkHfKeg==","signatures":[{"sig":"MEYCIQDAg5w6x7IJp6PCni8/Z3A87wYA4BB7nkKvBSiNvpMp+wIhANxrD2IdcexLw9AcVNj/T/ARmidrea7RPiTjqQQdcTI/","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","scripts":{"test":"mocha -R spec"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"https://github.com/flitbit/json-ptr","type":"git"},"_npmVersion":"1.3.8","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{"test":"test","example":"examples"},"devDependencies":{"mocha":"~1.10.x","expect.js":"~0.2.x"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.2.0":{"name":"json-ptr","version":"0.2.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@0.2.0","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"dist":{"shasum":"ab056c6367195695e076f3165c8129364d2242c0","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-0.2.0.tgz","integrity":"sha512-X5LVUtuf8NJz3uo0cMCv27EMLnmDmhY7lQ6Kt1zA7ISW4PKfQuRCi6bIPPZUcn/0PR4+20xcT7l2F/9VIrIRxg==","signatures":[{"sig":"MEYCIQD6nt6un/OgheQ6WgRuEGrOEXTnZkssRTguQFJy3HD9QwIhAJVjT/GhlevTfTLcd5ffJt/BpWxUhBk+GeTUBC2GaoGZ","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","scripts":{"test":"mocha -R spec"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"https://github.com/flitbit/json-ptr","type":"git"},"_npmVersion":"1.4.3","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{"test":"test","example":"examples"},"devDependencies":{"mocha":"~1.10.x","expect.js":"~0.2.x"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.3.0":{"name":"json-ptr","version":"0.3.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@0.3.0","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"dist":{"shasum":"abd0ca77e1f0e2dcf243d2ea9b5178a98390fe4c","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-0.3.0.tgz","integrity":"sha512-y8/nuthTySNgaMqaVLNGlwcxCTjoXp3Rp43fkQ/6hYbYNQauDjYv8OsWN/C64yz+Pr6Nm5AIlg33DA2h1M42kg==","signatures":[{"sig":"MEUCIHGHd1RRAWWo+k/tX2ISo+IPqwLxM8nhFVuKlepRa5jpAiEAtw+i43MVx4bzQvCpvtiiXGV2eputUKhLm4nobW6QH9o=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","config":{"blanket":{"pattern":["index.js"],"data-cover-never":["node_modules","tests"]}},"_shasum":"abd0ca77e1f0e2dcf243d2ea9b5178a98390fe4c","engines":{"node":">=4.0"},"gitHead":"77264a71004671a7845137b660372d931c694cb1","scripts":{"test":"mocha -R spec","cover":"istanbul cover ./node_modules/mocha/bin/_mocha --report html -- -R spec","uglify":"uglifyjs index.js -o releases/json-ptr-$npm_package_version.min.js  -r '$,require,exports,module,window,global' -m  --comments '/^!/'","pretest":"eslint ."},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"2.14.7","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{"test":"test","example":"examples"},"_nodeVersion":"4.2.3","devDependencies":{"mocha":"~2.3.4","blanket":"^1.2.1","expect.js":"~0.3.1"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"0.3.1":{"name":"json-ptr","version":"0.3.1","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@0.3.1","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"dist":{"shasum":"4ad887ea8dd98d44dd8b2097277e6c41ec7208bb","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-0.3.1.tgz","integrity":"sha512-7kuzJXXvneemhY6uWLMwvxEGz+Ihhrdh1rtcXKCHxmm4S9FWYinqxRPHzx2EGmqNqq/ulcRvuswR5vIOGQbdbw==","signatures":[{"sig":"MEQCIHgHm3iXtR6yU4JctO11OFgegGxh07HPjXBxreNdREeiAiA4+5f0Lynd6YKpKEBdhmMbOQwUpmPjZdOF2wfObAAHCw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","config":{"blanket":{"pattern":["index.js"],"data-cover-never":["node_modules","tests"]}},"_shasum":"4ad887ea8dd98d44dd8b2097277e6c41ec7208bb","engines":{"node":">=4.0"},"gitHead":"730ccd52f4be603e2ee7266605b024973c6a3857","scripts":{"test":"mocha -R spec","cover":"istanbul cover ./node_modules/mocha/bin/_mocha --report html -- -R spec","uglify":"uglifyjs index.js -o releases/json-ptr-$npm_package_version.min.js  -r '$,require,exports,module,window,global' -m  --comments '/^!/'","pretest":"eslint ."},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"2.14.7","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{"test":"test","example":"examples"},"_nodeVersion":"4.2.3","devDependencies":{"mocha":"~2.3.4","eslint":"^1.10.3","blanket":"^1.2.1","expect.js":"~0.3.1"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.0":{"name":"json-ptr","version":"1.0.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.0.0","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"dist":{"shasum":"ee29e3a3a1f00fc231b58f424d1744dad581ddd1","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.0.0.tgz","integrity":"sha512-9wdnucTES2R9lyROvvTm8UrLvB0c43qqDeExqjAxR6bD88NYdWEiVzNgGu37z/MfOWTnDmaZ48x2cZfIbYWgBQ==","signatures":[{"sig":"MEUCIEUPblPKoaCL1ltU8REgHh3WDGuQd7oppM7BixoLkbdpAiEA83bkdkSuP0oLbtYIN+lGxdUozGlqBmZ/51AW1qw+skk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"main":"index.js","_from":".","config":{"blanket":{"pattern":["index.js"],"data-cover-never":["node_modules","tests"]}},"_shasum":"ee29e3a3a1f00fc231b58f424d1744dad581ddd1","engines":{"node":">=4.0"},"gitHead":"27908bfce677cebf2c0142554fb628a3a8cbf6c3","scripts":{"test":"mocha -R spec","cover":"istanbul cover ./node_modules/mocha/bin/_mocha --report html -- -R spec","pretest":"eslint .","release":"babel --minified --no-comments index.js --out-file releases/json-ptr-$npm_package_version.min.js"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"2.14.7","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{"test":"test","example":"examples"},"_nodeVersion":"4.2.3","devDependencies":{"mocha":"~2.3.4","eslint":"^1.10.3","blanket":"^1.2.1","babel-cli":"^6.3.17","expect.js":"~0.3.1"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.0.1":{"name":"json-ptr","version":"1.0.1","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.0.1","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"dist":{"shasum":"e5d74e855eb5f58ef681a5ea5aafe4d9ac596780","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.0.1.tgz","integrity":"sha512-olQerTLVTivswIIFfQxqB8rEdubYTAlX+dTlVKqov5b+Kxg0xzvkSSIxMgihE9g6u1wYEkudu2/veTrZzzD+ww==","signatures":[{"sig":"MEUCIQDXmooUb4hYWeHtxtOKC3O3GC7Qmh+RHUp/+Jpjr4i7kwIgNpT6eohtYnrl0Z3gT4YB4/VHZSxwVkmvB2NbM0PfS+U=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}]},"jspm":{"main":"json-ptr-1.0.1.min.js","directories":{"lib":"releases"}},"main":"index.js","_from":".","config":{"blanket":{"pattern":["index.js"],"data-cover-never":["node_modules","tests"]}},"_shasum":"e5d74e855eb5f58ef681a5ea5aafe4d9ac596780","engines":{"node":">=4.0"},"gitHead":"444626245bf964ab09a4fb5abcb1899ccbbd4be7","scripts":{"test":"mocha -R spec","cover":"istanbul cover ./node_modules/mocha/bin/_mocha --report html -- -R spec","pretest":"eslint .","release":"babel --presets es2015 --minified --no-comments index.js --out-file releases/json-ptr-$npm_package_version.min.js"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"3.9.0","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{"test":"test","example":"examples"},"_nodeVersion":"4.4.4","devDependencies":{"mocha":"~2.3.4","eslint":"^1.10.3","blanket":"^1.2.1","babel-cli":"^6.3.17","expect.js":"~0.3.1","babel-preset-es2015":"^6.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr-1.0.1.tgz_1469974577384_0.675336767686531","host":"packages-12-west.internal.npmjs.com"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.1.0":{"name":"json-ptr","version":"1.1.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.1.0","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"dist":{"shasum":"44e7ddf2f99eee6b3f312580614d383bdf46c1be","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.1.0.tgz","fileCount":28,"integrity":"sha512-/5wyr0PEFeLk2jh88CBZZPJD6wqe/bJvqAIWXbkBOKxvgeHlM67Ilu8b0QKKyLhfSP+9uvA+NSAo2/n62q68aQ==","signatures":[{"sig":"MEYCIQDrZbd+9CN095eV+SNAlCd36HFrFPGwtvBwNxLGK73LsgIhAJTXP5WcGlCg1W3J8ZFNRkwJ5PG+33YU/uZeqHfJpRFm","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87734},"main":"index.js","gitHead":"037ac352907fc8e8093ecb1777493ab2bc3a1f58","scripts":{"ci":"mocha --reporter mocha-junit-reporter test/**/*.js","lint":"eslint src test","test":"mocha test/**/*.js","clean":"rimraf dist && mkdir dist","preci":"npm run lint","pretest":"npm run lint","release":"uglifyjs -c -m -o dist/json-ptr.min.js -r '$,require,exports,self,module,define' index.js","prerelease":"npm run clean && npm run test","preversion":"npm run release","test:watch":"nodemon --ext js,json --ignore dist/ --exec 'npm test'","postversion":"git push && git push --tags"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"5.6.0","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"8.9.4","_hasShrinkwrap":false,"devDependencies":{"json":"^9.0.6","mocha":"^5.0.1","eslint":"^4.18.1","rimraf":"^2.6.2","nodemon":"^1.15.1","bluebird":"^3.5.1","expect.js":"^0.3.1","uglify-js":"^3.3.12","eslint-plugin-mocha":"^4.11.0","mocha-junit-reporter":"^1.17.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.1.0_1519508993701_0.01690909869044055","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.1.1":{"name":"json-ptr","version":"1.1.1","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.1.1","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"dist":{"shasum":"fa7e92824c34d27c25656e04a8bc69befcf4c2ed","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.1.1.tgz","fileCount":28,"integrity":"sha512-AGCtezsBJDtAvh6XP4afC7+EifV4nCJnnUC1lqxBSvu3EGqAtnRz6s1PpsYJqLNCAYsZ1NojXvbga0TIzJyO/w==","signatures":[{"sig":"MEYCIQD3/uEsamNSjTfsYAbOzN5KK696YasBi/U5BVCMozEeOQIhAIvYo5WcbYQkQ+C4z6fMbYJpyUe3wDJXtRNR1+KSSOiL","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":87944,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbw5UdCRA9TVsSAnZWagAAjX4P/RP4fL01TVZIrENAwGe5\nWsEatsotw2GFxhgswlh42U7/5/ryfKsyohOUIXoSNxAEmAu2MwRG9OfMMxdZ\nYHYWQXxzj7AQISbkO7zKIvlXeRxMQXTHMBBXC3z0RzIYFjrtDoSi+813P4zi\nFkiJnt5ryXsgkShqTtmmVXlPnTza1H+x97hB4TRdfHnI7VjfBhhTKBqFrvcc\nRNitUhbWKeWmtyHbfSRRt40EhjTUojNnh/Nh16NezK0H4Ib9squrCN2EVSCt\nuN1k6yylxnn1R9nkvx65cWbD3wtKxZjCeyXczVHZIN7p6qy5RXwkUoAzNqK1\nm101De/fkSMbI217DtIsVNaqJA8KrkVcEoTYU6hNJCLdcRAJI3G45D7QzmzB\n3s/Lfzl8B1yjmSLFYZFXZXPdTl2nb10Q5H2rzuu8suw4Cya27Drp9Jj5bYw0\nnQhXjpJcrbhXBWc2BG43hcj3njI85LWdqid2lky6PHxRUhFSBlzW7JVGvAAN\n3HyqfG+mYKxntLkBp01NDDnUiCLn5v9x9ivrDP1q/hVEraqkiQCkEjWSieLv\nFnQBvydZ0RPCpmKqjEy3iQdqGOSitEtYt6c3LP1zMYU4Knc5nJsMVJbzDWOb\nHFUtX6f1mJ0P1xEegv30KQ/oCqdckpFx4lYTGagOjyBDRgo7mo/Te0QAlOum\nth2d\r\n=QG7y\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"daf1e16615aa530be1b583a2570dea503f81a268","scripts":{"ci":"mocha --reporter mocha-junit-reporter test/**/*.js","lint":"eslint index.js test","test":"mocha test/**/*.js","clean":"rimraf dist && mkdir dist","preci":"npm run lint","pretest":"npm run lint","release":"uglifyjs -c -m -o dist/json-ptr.min.js -r '$,require,exports,self,module,define' index.js","prerelease":"npm run clean && npm run test","preversion":"npm run release","test:watch":"nodemon --ext js,json --ignore dist/ --exec 'npm test'","postversion":"git push && git push --tags"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"5.6.0","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"8.9.4","_hasShrinkwrap":false,"devDependencies":{"json":"^9.0.6","mocha":"^5.2.0","eslint":"^5.7.0","rimraf":"^2.6.2","nodemon":"^1.18.4","bluebird":"^3.5.2","expect.js":"^0.3.1","uglify-js":"^3.4.9","eslint-plugin-mocha":"^5.2.0","mocha-junit-reporter":"^1.18.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.1.1_1539544348284_0.8363309581765372","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.1.2":{"name":"json-ptr","version":"1.1.2","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.1.2","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"dist":{"shasum":"38699cbe1820659dd142687ba7d763621e386595","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.1.2.tgz","fileCount":29,"integrity":"sha512-XBEkso0S0K1+AlTKXTfGhVPTkFgSGoPcd+ssFlg/vShvNROfvxnLlfeyXgziSgV26Yz0cN5+TVn8ANlC8+QM9w==","signatures":[{"sig":"MEYCIQDXJ9pnhN5flJLWrZwZAkRBmHbxsgMZELd0EeOXa+UQpwIhAODluxCc89EMJspp3yN6eYSyGxsB4+P5Cf9gMvpoHVxw","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":88242,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJchT8+CRA9TVsSAnZWagAAwlkP/ihz45+2KV62gRn0oQ4m\nTYNbbU9us9YFkj0AvtKR3x6zP87hI2C8ZGhPbYIhfsIvifWiCVk8+Y3p8Fp0\n4okXYdFEdhqBO0ibYuMUE7cepqvmcGL5LJy9UY9ZmZ/7BOkcehJn+kG+1HlB\n3tyNrmqb+SFS21LO2v8Fe1c/7ROw/GxN5RS7wFoiJrn15TOAQSSUjMBybBrm\nClmMY2NgbLyl8XQ6PXgIB5h2933ptP5hMhQy2KZvcln92fxqSVb7Q4y9VMvO\nhTGE7sy75AptqwCVe1rxyyKxf1jJiEeemjtCU3Rg8rPxjkYjJhHITjxqMgh6\n7sIHUUd+LR6gdG1Gyg/9KMynoGHY220J2+/HQXQiMqbfiqrnyGAOoXQR1FV+\nqGd3adG5NpYEZQcVntqZ0t3mlaWVsTM4Me2WmFPnLLfyciy62xDyDv/bS0Vn\nCPT4QT+IyJgWwpcBNOjk8kuklOiou0OfId3H9l8D3HNQHPp1wGNNHHHaOimk\nkLGLAj/q739TBVCVWistJNOyPSZ7GVzBEIMJFfQ+fxhcyJMmDJNEGorbSGKo\nleuIstDjJgpLvwgQqXk9CVwRZSyTmc/bGFmm40epyRbIjiPat6cNPi/yf4C8\naIleGIm/RCmRQniyFF30HB0ZF0Ug080GEmCI5fAJwR2OFUuJsPBIu/oCpc5m\nDDa+\r\n=yBI4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"e3a9599f687b5ec34d988e2e7c6ef8c443f571f9","scripts":{"ci":"mocha --reporter mocha-junit-reporter test/**/*.js","lint":"eslint index.js test","test":"mocha test/**/*.js","clean":"rimraf dist && mkdir dist","preci":"npm run lint","pretest":"npm run lint","release":"uglifyjs -c -m -o dist/json-ptr.min.js -r '$,require,exports,self,module,define' index.js","prerelease":"npm run clean && npm run test","preversion":"npm run release","test:watch":"nodemon --ext js,json --ignore dist/ --exec 'npm test'","postversion":"git push && git push --tags"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"5.6.0","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"8.9.4","_hasShrinkwrap":false,"devDependencies":{"json":"^9.0.6","mocha":"^6.0.2","eslint":"^5.15.1","rimraf":"^2.6.3","nodemon":"^1.18.10","bluebird":"^3.5.3","expect.js":"^0.3.1","uglify-js":"^3.4.9","eslint-plugin-mocha":"^5.3.0","mocha-junit-reporter":"^1.18.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.1.2_1552236349402_0.5705685043780693","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.0":{"name":"json-ptr","version":"1.2.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.0","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"dist":{"shasum":"e588fa5f937f220f59f73e7f480f9f52a6f79328","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.0.tgz","fileCount":29,"integrity":"sha512-wkqozzmmyu+vtazHF11uvIDbLsgkE4juY41QoXgKYSy166KQalyc72PqveII21f8UWKtYN7btUXg16vya+9xnw==","signatures":[{"sig":"MEQCIDVx5lFDj4xRFP6ZTFNA48VHcYizgHKsQ+78HaOsDuxtAiADNZY6QNlLWf5n+mcjjdR3Ajgy5TqUMOcRlSuE7lmc8w==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":89527,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdfOyfCRA9TVsSAnZWagAAymkP+gNCtzCuSMrlpyvdwDw9\n7RbOl+JHp4dMSSGCeMmZs9WYpkEtSwYLUEKh9tvdPP15z0UMIicCWA9mFfYu\n930zQcZNhvK6wieFgpCIadiAXQd/tvuz7o5yGDWoSaNndoyuk+Yi1/9ZC4od\nUPrzYyU4/sBW5M2FUVibaWzlC2i+PoIyJy8C6UkAhHyqbz50MJrlZ2+/wQVZ\nvcUwm/iYIdg6vB9mJfAR+BkpsmLpjwv9qrdpKHHNtwKCP/ip25vY+6FwYP2I\nSA1t7xan7B9Jdxz0W0XP/KAgQO8WRjLxGDk3h/uDQypqkAcJ6UoJXD9PFZ6h\npc+Jund39/aimSn77c70ZCM9dCKAI9TayD0wBadW3BMNxY8bjdYTWtuaNPNm\n4OYe4p6VofRXKd49fDPqjMSmgTgmA7LFsJitS9UOtvGFGELiDJQXA+KkgEco\nzjEPzEM2ff+WXWVC0kC9+yF7SebjjyaeD2tnKrafK+IcLpe7A8JWMMawOX2V\npYfozVdb2itkZ0rvVf9k/hxktsOSlG5qv9nLxsSXMIEW4sO3T3IePE2iuBcq\ncfzZCHO5aLsl3DpzithZQXDZV8zOwxwM1+SJBN3qsR6SAWaxv/t/uGozGwR6\naHJlH+vqEB8diKSJdBhbkIQ1QQTW6o75j5kaCdiX4Y4IEbzA6KFBZOM+UIFo\naBNu\r\n=hl6d\r\n-----END PGP SIGNATURE-----\r\n"},"main":"index.js","gitHead":"eff47a3d8eaf15dc1dc340c9f0cbe8d3522d3541","scripts":{"ci":"mocha --reporter mocha-junit-reporter test/**/*.js","lint":"eslint index.js test","test":"mocha test/**/*.js --reporter tap","clean":"rimraf dist && mkdir dist","preci":"npm run lint","pretest":"npm run lint","release":"uglifyjs -c -m -o dist/json-ptr.min.js -r '$,require,exports,self,module,define' index.js","prerelease":"npm run clean && npm run test","preversion":"npm run release","test:watch":"nodemon --ext js,json --ignore dist/ --exec 'npm test'","postversion":"git push && git push --tags"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.9.0","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"10.16.3","_hasShrinkwrap":false,"devDependencies":{"json":"^9.0.6","mocha":"^6.2.0","eslint":"^6.4.0","rimraf":"^3.0.0","nodemon":"^1.19.2","bluebird":"^3.5.5","expect.js":"^0.3.1","uglify-js":"^3.6.0","eslint-plugin-mocha":"^6.1.1","mocha-junit-reporter":"^1.23.1"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.0_1568468126511_0.16680750865137295","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.0-ts.38ea8fe":{"name":"json-ptr","version":"1.2.0-ts.38ea8fe","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.0-ts.38ea8fe","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"be6c51533882f6c3580e4e8d98d86cebf4a54b47","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.0-ts.38ea8fe.tgz","fileCount":43,"integrity":"sha512-gd0uoAkKv1kdM9f/VL5Xgle1liUDHIKs0CouIdK1fO8LPoEHod4GdZIYvaCfkD8tdzufK0Q+ETPX6t6cIIN2mQ==","signatures":[{"sig":"MEQCIE1ZPctPfjCnXVunYhKVyr4msVkdb+OJOThjEhvX7Y08AiAIf3Q9zkZfPuYPCGtQVtkGQ3yyT6UeXUD+tABY3TgnKQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":200510,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeSsOzCRA9TVsSAnZWagAAE8QP/1vEBlocL/LYz/U1+hiT\nbSxXyem8tNGuAd+6m+e11viATTcaAiLnn90Bz07xiVH72HW2ewK+7zGvWmTL\noPm3Qoe2JyqI7k47te33au08Eol/sbc6qTEYfGe5BtEeR9/x3NibyNyzjnwG\ncc290EqJMiiXP6Q+DSoUXfWpFqVW2qgrCguBUBzBqqsfihh39Lgz2h6Mrc9C\nDhy8JvyLOc1l/c6PhOaQ9BkGt7K6XcG4NeixSnH/6/ACElcCUGkCZ5YsEAk9\nZm5cgng3sk6VzOAnmKCVkylXut2Uah7Pf+G0xbahkIWqek5Tfq2IZFLC4vK5\nCZMwVrW45g7PnB8FIlPP+sgxas/Uvv4bfOthI66x+bICWCMOBwSNT+waT83t\ngKbikl35OV0vCknM9sonyLbVevI7TbT9hEelJU6kHG0aiIeyMqAsBBLxZpmE\nvOuA/mozZ+2TjXuD0CYI4EbB+Q6eOjOzU2NpEy58U0/H68Mj4PjL3jGrPf98\nUpFNoYXIichpXOjWf8WN3ld1xnw2qlz5pKVIYGvGo2C02rNTnPM6Ir7Ff8Yq\ng/g3QOgMUViXVm6OKLtFWJV3lj2r/bDJTWvbvxVupIgbSf1StDzRbLQ+1/VD\nDbK/hK4fqLtt5YIjoZdi72Ev+j7NuiCa5sanm3b3a/4DGDk/40p7Iq/2mbN4\nnWmn\r\n=Buez\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this module a couple of years ago when I was unable to find what I considered a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\nSince there are a few npm modules for you to choose from, see [the section on performance later in this _readme_](#user-content-performance); you can use your own judgement as to which package you should employ.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Module API\n\n#### Classes\n\n* [`JsonPointer`](#user-content-jsonpointer-class) : _class_ &ndash; a convenience class for working with JSON pointers.\n* [`JsonReference`](#user-content-jsonreference-class) : _class_ &ndash; a convenience class for working with JSON references.\n\n#### Functions\n\n* [`.create(pointer)`](#user-content-createpointer)\n* [`.has(target,pointer)`](#user-content-hastargetpointer)\n* [`.get(target,pointer)`](#user-content-gettargetpointer)\n* [`.set(target,pointer,value,force)`](#user-content-settarget-pointer-value-force)\n* [`.flatten(target,fragmentId)`](#user-content-flattentarget-fragmentid)\n* [`.list(target,fragmentId)`](#user-content-listtarget-fragmentid)\n* [`.map(target,fragmentId)`](#user-content-maptarget-fragmentid)\n\nAll example code assumes data has this structure:\n\n```javascript\nconst data = {\n  legumes: [{\n    name: 'pinto beans',\n    unit: 'lbs',\n    instock: 4\n  }, {\n    name: 'lima beans',\n    unit: 'lbs',\n    instock: 21\n  }, {\n    name: 'black eyed peas',\n    unit: 'lbs',\n    instock: 13\n  }, {\n    name: 'plit peas',\n    unit: 'lbs',\n    instock: 8\n  }]\n}\n```\n\n#### .create(pointer: string | string[]): JsonPointer\n\nCreates an instance of the `JsonPointer` class.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* a new [`JsonPointer` instance](#user-content-jsonpointer-class)\n\n_example:_\n\n```ts\nconst pointer = JsonPointer.create('/legumes/0');\n// fragmentId: #/legumes/0\n```\n\n#### .has&lt;T>(target: T, pointer: string | string[] | JsonPointer): boolean\n\nDetermins whether the specified `target` has a value at the `pointer`'s path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n#### .get(target,pointer)\n\nGets a value from the specified `target` object at the `pointer`'s path\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nlet value = JsonPointer.get(data, '/legumes/1');\n// fragmentId: #/legumes/1\n```\n\n#### .set(target, pointer, value, force)\n\nSets the `value` at the specified `pointer` on the `target`. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_returns:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n_example:_\n\n```javascript\nlet prior = JsonPointer.set(data, '#/legumes/1/instock', 50);\n```\n\nexample force:\n\n```javascript\nlet data = {};\n\nJsonPointer.set(data, '#/peter/piper', 'man', true);\nJsonPointer.set(data, '#/peter/pan', 'boy', true);\nJsonPointer.set(data, '#/peter/pickle', 'dunno', true);\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"piper\": \"man\",\n    \"pan\": \"boy\",\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .list(target, fragmentId)\n\nLists all of the pointers available on the specified `target`.\n\n> See [a discussion about cycles in the object graph later in this document](#user-content-object-graph-cycles-and-recursion) if you have interest in how such is dealt with.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* an array of `pointer-value` pairs\n\n_example:_\n\n```javascript\nlet list = JsonPointer.list(data);\n```\n\n```json\n[ ...\n  {\n    \"pointer\": \"/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"pointer\": \"/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"pointer\": \"/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"pointer\": \"/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"pointer\": \"/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n_`fragmentId` example:_\n\n```javascript\nlet list = JsonPointer.list(data, true);\n```\n\n```json\n[ ...\n  {\n    \"fragmentId\": \"#/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n#### .flatten(target, fragmentId)\n\nFlattens an object graph (the `target`) into a single-level object of `pointer-value` pairs.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a flattened object of `property-value` pairs as properties.\n\n_example:_\n\n```javascript\nlet obj = JsonPointer.flatten(data, true);\n```\n\n```json\n{ ...\n  \"#/legumes/1/name\": \"lima beans\",\n  \"#/legumes/1/unit\": \"lbs\",\n  \"#/legumes/1/instock\": 21,\n  \"#/legumes/2/name\": \"black eyed peas\",\n  \"#/legumes/2/unit\": \"ea\",\n  \"#/legumes/2/instock\": 9340,\n  \"#/legumes/3/name\": \"plit peas\",\n  \"#/legumes/3/unit\": \"lbs\",\n  \"#/legumes/3/instock\": 8\n}\n```\n\n#### .map(target, fragmentId)\n\nFlattens an object graph (the `target`) into a [Map object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a Map object containing key-value pairs where keys are pointers.\n\n_example:_\n\n```javascript\nlet map = JsonPointer.map(data, true);\n\nfor (let it of map) {\n  console.log(JSON.stringify(it, null, '  '));\n}\n```\n\n```json\n...\n[\"#/legumes/0/name\", \"pinto beans\"]\n[\"#/legumes/0/unit\", \"lbs\"]\n[\"#/legumes/0/instock\", 4 ]\n[\"#/legumes/1/name\", \"lima beans\"]\n[\"#/legumes/1/unit\", \"lbs\"]\n[\"#/legumes/1/instock\", 21 ]\n[\"#/legumes/2/name\", \"black eyed peas\"]\n[\"#/legumes/2/unit\", \"ea\"]\n[\"#/legumes/2/instock\", 9340 ]\n[\"#/legumes/3/name\", \"plit peas\"]\n[\"#/legumes/3/unit\", \"lbs\"]\n[\"#/legumes/3/instock\", 8 ]\n```\n\n#### .decode(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = JsonPointer.decode('#/legumes/1/instock');\n```\n\n```json\n[ \"legumes\", \"1\", \"instock\" ]\n```\n\n#### decodePointer(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('/people/wilbur dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodePointer(path)\n\nEncodes the specified `path` as a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_arguments:_\n\n* `path` : _Array, required_ &ndash; an array of path segments\n\n_returns:_\n\n* A JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_example:_\n\n```javascript\nlet path = encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"/people/wilbur dongleworth/age\"\n```\n\n#### decodeUriFragmentIdentifier(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('#/people/wilbur%20dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodeUriFragmentIdentifier(path)\n\nEncodes the specified `path` as a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_arguments:_\n\n* `path` : _Array, required_ - an array of path segments\n\n_returns:_\n\n* A JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_example:_\n\n```javascript\nlet path = ptr.encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"#/people/wilbur%20dongleworth/age\"\n```\n\n### `JsonPointer` Class\n\nEncapsulates pointer related operations for a specified `pointer`.\n\n_properties:_\n\n* `.path` : _array_ &ndash; contains the pointer's path segements.\n* `.pointer` : _string_ &ndash; the pointer's [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5)\n* `.uriFragmentIdentifier` : _string_ &ndash; the pointer's [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_methods:_\n\n#### .has(target)\n\nDetermins whether the specified `target` has a value at the pointer's path.\n\n#### .get(target)\n\nLooks up the specified `target`'s value at the pointer's path if such exists; otherwise _undefined_.\n\n#### .set(target, value, force)\n\nSets the specified `target`'s value at the pointer's path, if such exists.If `force` is specified (_truthy_), missing path segments are created and the value is always set at the pointer's path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_result:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n#### .concat(target)\n\nCreates new pointer appending target to the current pointer's path\n\n_arguments:_\n\n* `target` : _JsonPointer, array or string, required_ &ndash; the path to be appended to the current path\n\n## Performance\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n_Consider this example code that queries the flickr API and prints results to the console:_\n\n```javascript\n'use strict';\n\nlet ptr = require('..'),\n  http = require('http'),\n  util = require('util');\n\n// A flickr feed, tags surf,pipeline\nlet feed = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=surf,pipeline&tagmode=all&format=json&jsoncallback=processResponse';\n\n// Compile/prepare the pointers...\nlet items = ptr.create('#/items');\nlet author = ptr.create('#/author');\nlet media = ptr.create('#/media/m');\n\nfunction processResponse(json) {\n  let data = items.get(json);\n\n  if (data && Array.isArray(data)) {\n    let images = data.reduce((acc, it) => {\n      // Using the prepared pointers to select parts...\n      acc.push({\n        author: author.get(it),\n        media: media.get(it)\n      });\n      return acc;\n    }, []);\n    console.log(util.inspect(images, false, 9));\n  }\n}\n\nhttp.get(feed, function(res) {\n  let data = '';\n\n  res.on('data', function(chunk) {\n    data += chunk;\n  });\n\n  res.on('end', function() {\n    // result is formatted as jsonp... this is for illustration only.\n    data = eval(data); // eslint-disable-line no-eval\n    processResponse(data);\n  });\n}).on('error', function(e) {\n  console.log('Got error: ' + e.message);\n});\n```\n\n> \\[[example/real-world.js](https://github.com/flitbit/json-ptr/blob/master/examples/real-world.js)]\n\n## Tests\n\nTests are written using [mocha](https://mochajs.org/) and [expect.js](https://github.com/Automattic/expect.js).\n\n```bash\nnpm test\n```\n\n... or ...\n\n```bash\nmocha\n```\n\n## Releases\n\n* 2019-09-14 &mdash; __1.2.0__\n  * Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n* 2019-03-10 &mdash; __1.1.2__\n  * Updated packages to remove critical security concern among dev dependencies'\n\n* 2016-07-26 &mdash; __1.0.1__\n  * Fixed a problem with the Babel configuration\n\n* 2016-01-12 &mdash; __1.0.0__\n  * Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n* 2016-01-02 &mdash; __0.3.0__\n  * Retooled for node 4+\n  * Better compiled pointers\n  * Unrolled recursive `.list` function\n  * Added `.map` function\n  * Fully linted\n  * Lots more tests and examples.\n  * Documented many previously undocumented features.\n\n* 2014-10-21 &mdash; __0.2.0__  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"38ea8fe9e30752214eac53bbd393111b85d896b2","scripts":{"ci":"npm run test","docs":"typedoc","lint":"eslint src --ext .js,.ts,.json","test":"nyc mocha src/**/*.spec.ts","build":"tsc --build tsconfig.json","clean":"rimraf dist .nyc_output coverage","pretest":"npm run build","prebuild":"npm run lint","preversion":"npm run build"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.13.4","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.0.0","bent":"^7.0.6","chai":"^4.2.0","mocha":"^7.0.1","eslint":"^6.8.0","lodash":"^4.17.15","rimraf":"^3.0.2","ts-node":"^8.6.2","typedoc":"^0.16.10","prettier":"^1.19.1","typescript":"^3.7.5","@types/bent":"^7.0.1","@types/chai":"^4.2.9","@types/mocha":"^7.0.1","@types/assert-plus":"^1.0.4","eslint-plugin-json":"^2.0.1","source-map-support":"^0.5.16","eslint-plugin-mocha":"^6.2.2","eslint-plugin-import":"^2.20.1","eslint-config-prettier":"^6.10.0","eslint-plugin-prettier":"^3.1.2","@typescript-eslint/parser":"^2.19.2","@typescript-eslint/eslint-plugin":"^2.19.2"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.0-ts.38ea8fe_1581958067008_0.3526546097277159","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.0-ts.da6e2a1":{"name":"json-ptr","version":"1.2.0-ts.da6e2a1","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.0-ts.da6e2a1","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"231c7b99d01a689878750f6358da363ead5f508f","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.0-ts.da6e2a1.tgz","fileCount":43,"integrity":"sha512-3UDyUUDymB/nsy3AcDwL/00RtPNIvSfPVK8SYxe/oh+7DBP98YLAJ+a48uwfckJ6kM0xhHRm2XX0gaJseIlY8Q==","signatures":[{"sig":"MEUCIALjKV6s9L45zCgXFCTa+8mGXLiP+LZ9qqWmA//RbFffAiEAvb7t4KSqMpZ4IwWDZu7jbLyN/oxhRKjdHqivoygfBDg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":200510,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeSsPnCRA9TVsSAnZWagAAbTkP/1bDhVa+E+1Pn/idNB0+\nuC+Zt6l+6jcV6axCPMbp60xUkdnZjmN0wJTr0HxSIJ9TnqiGFT2fUvGlLp77\nDUXsgkR6O3Ln94fzHf9ycSD5IcG7M8xYOB+/CXoSO5CK6PLJfV41ooRlkez4\ne1pu8YyjWL0xor52V2SwYitEcjwOJTptkKCBAme4ZKTWoBnxJ+W/QJ3nzJKY\ngQ1+b+Y7wL/EuGBsvVdpE+VaFWBSbTiDP3lm2BlHpkt15YAIfYZ2LAQasemb\n6Q6bHiwqfDP4qrMWjZQ9NMF6ERZga/CkhtJ1JJRAE+Z+EugqyPzPktEgJZLN\nwMcTW3cCOYf8dDj1lVraRWsR8MZcewRuJ466IDyYMkqFLAEKl33OvxZ4uKYI\nJiJH+iPaBUkdqc7GdGw8Bb+4RrMdyEmNjSjhY1i/RqZrDVSvscjJ915tdNcH\nVzN8o+e8611pvtD/DNt5QSTPBijPbsf2b1ylanqC51SkoSLtbv9DnADUHDTZ\nM43KrZIoirkAcpCNK2VjknbblTXv32mb28vIubTfphJHe3hTx672ki+reXGl\np8CeUvqCABlhjcSyeQw3gfuITkGP8fzFR5s0IcPn3cjF3oG0KlhEOhSfQuPZ\n0QY49dtCztDxgH8ZNfsqOVeg+DGZgzzlmSKWSDa9N6SmWXblPPMAWDYIjjE0\n+9m0\r\n=/F9O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this module a couple of years ago when I was unable to find what I considered a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\nSince there are a few npm modules for you to choose from, see [the section on performance later in this _readme_](#user-content-performance); you can use your own judgement as to which package you should employ.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Module API\n\n#### Classes\n\n* [`JsonPointer`](#user-content-jsonpointer-class) : _class_ &ndash; a convenience class for working with JSON pointers.\n* [`JsonReference`](#user-content-jsonreference-class) : _class_ &ndash; a convenience class for working with JSON references.\n\n#### Functions\n\n* [`.create(pointer)`](#user-content-createpointer)\n* [`.has(target,pointer)`](#user-content-hastargetpointer)\n* [`.get(target,pointer)`](#user-content-gettargetpointer)\n* [`.set(target,pointer,value,force)`](#user-content-settarget-pointer-value-force)\n* [`.flatten(target,fragmentId)`](#user-content-flattentarget-fragmentid)\n* [`.list(target,fragmentId)`](#user-content-listtarget-fragmentid)\n* [`.map(target,fragmentId)`](#user-content-maptarget-fragmentid)\n\nAll example code assumes data has this structure:\n\n```javascript\nconst data = {\n  legumes: [{\n    name: 'pinto beans',\n    unit: 'lbs',\n    instock: 4\n  }, {\n    name: 'lima beans',\n    unit: 'lbs',\n    instock: 21\n  }, {\n    name: 'black eyed peas',\n    unit: 'lbs',\n    instock: 13\n  }, {\n    name: 'plit peas',\n    unit: 'lbs',\n    instock: 8\n  }]\n}\n```\n\n#### .create(pointer: string | string[]): JsonPointer\n\nCreates an instance of the `JsonPointer` class.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* a new [`JsonPointer` instance](#user-content-jsonpointer-class)\n\n_example:_\n\n```ts\nconst pointer = JsonPointer.create('/legumes/0');\n// fragmentId: #/legumes/0\n```\n\n#### .has&lt;T>(target: T, pointer: string | string[] | JsonPointer): boolean\n\nDetermins whether the specified `target` has a value at the `pointer`'s path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n#### .get(target,pointer)\n\nGets a value from the specified `target` object at the `pointer`'s path\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nlet value = JsonPointer.get(data, '/legumes/1');\n// fragmentId: #/legumes/1\n```\n\n#### .set(target, pointer, value, force)\n\nSets the `value` at the specified `pointer` on the `target`. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_returns:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n_example:_\n\n```javascript\nlet prior = JsonPointer.set(data, '#/legumes/1/instock', 50);\n```\n\nexample force:\n\n```javascript\nlet data = {};\n\nJsonPointer.set(data, '#/peter/piper', 'man', true);\nJsonPointer.set(data, '#/peter/pan', 'boy', true);\nJsonPointer.set(data, '#/peter/pickle', 'dunno', true);\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"piper\": \"man\",\n    \"pan\": \"boy\",\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .list(target, fragmentId)\n\nLists all of the pointers available on the specified `target`.\n\n> See [a discussion about cycles in the object graph later in this document](#user-content-object-graph-cycles-and-recursion) if you have interest in how such is dealt with.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* an array of `pointer-value` pairs\n\n_example:_\n\n```javascript\nlet list = JsonPointer.list(data);\n```\n\n```json\n[ ...\n  {\n    \"pointer\": \"/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"pointer\": \"/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"pointer\": \"/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"pointer\": \"/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"pointer\": \"/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n_`fragmentId` example:_\n\n```javascript\nlet list = JsonPointer.list(data, true);\n```\n\n```json\n[ ...\n  {\n    \"fragmentId\": \"#/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n#### .flatten(target, fragmentId)\n\nFlattens an object graph (the `target`) into a single-level object of `pointer-value` pairs.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a flattened object of `property-value` pairs as properties.\n\n_example:_\n\n```javascript\nlet obj = JsonPointer.flatten(data, true);\n```\n\n```json\n{ ...\n  \"#/legumes/1/name\": \"lima beans\",\n  \"#/legumes/1/unit\": \"lbs\",\n  \"#/legumes/1/instock\": 21,\n  \"#/legumes/2/name\": \"black eyed peas\",\n  \"#/legumes/2/unit\": \"ea\",\n  \"#/legumes/2/instock\": 9340,\n  \"#/legumes/3/name\": \"plit peas\",\n  \"#/legumes/3/unit\": \"lbs\",\n  \"#/legumes/3/instock\": 8\n}\n```\n\n#### .map(target, fragmentId)\n\nFlattens an object graph (the `target`) into a [Map object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a Map object containing key-value pairs where keys are pointers.\n\n_example:_\n\n```javascript\nlet map = JsonPointer.map(data, true);\n\nfor (let it of map) {\n  console.log(JSON.stringify(it, null, '  '));\n}\n```\n\n```json\n...\n[\"#/legumes/0/name\", \"pinto beans\"]\n[\"#/legumes/0/unit\", \"lbs\"]\n[\"#/legumes/0/instock\", 4 ]\n[\"#/legumes/1/name\", \"lima beans\"]\n[\"#/legumes/1/unit\", \"lbs\"]\n[\"#/legumes/1/instock\", 21 ]\n[\"#/legumes/2/name\", \"black eyed peas\"]\n[\"#/legumes/2/unit\", \"ea\"]\n[\"#/legumes/2/instock\", 9340 ]\n[\"#/legumes/3/name\", \"plit peas\"]\n[\"#/legumes/3/unit\", \"lbs\"]\n[\"#/legumes/3/instock\", 8 ]\n```\n\n#### .decode(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = JsonPointer.decode('#/legumes/1/instock');\n```\n\n```json\n[ \"legumes\", \"1\", \"instock\" ]\n```\n\n#### decodePointer(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('/people/wilbur dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodePointer(path)\n\nEncodes the specified `path` as a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_arguments:_\n\n* `path` : _Array, required_ &ndash; an array of path segments\n\n_returns:_\n\n* A JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_example:_\n\n```javascript\nlet path = encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"/people/wilbur dongleworth/age\"\n```\n\n#### decodeUriFragmentIdentifier(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('#/people/wilbur%20dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodeUriFragmentIdentifier(path)\n\nEncodes the specified `path` as a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_arguments:_\n\n* `path` : _Array, required_ - an array of path segments\n\n_returns:_\n\n* A JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_example:_\n\n```javascript\nlet path = ptr.encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"#/people/wilbur%20dongleworth/age\"\n```\n\n### `JsonPointer` Class\n\nEncapsulates pointer related operations for a specified `pointer`.\n\n_properties:_\n\n* `.path` : _array_ &ndash; contains the pointer's path segements.\n* `.pointer` : _string_ &ndash; the pointer's [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5)\n* `.uriFragmentIdentifier` : _string_ &ndash; the pointer's [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_methods:_\n\n#### .has(target)\n\nDetermins whether the specified `target` has a value at the pointer's path.\n\n#### .get(target)\n\nLooks up the specified `target`'s value at the pointer's path if such exists; otherwise _undefined_.\n\n#### .set(target, value, force)\n\nSets the specified `target`'s value at the pointer's path, if such exists.If `force` is specified (_truthy_), missing path segments are created and the value is always set at the pointer's path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_result:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n#### .concat(target)\n\nCreates new pointer appending target to the current pointer's path\n\n_arguments:_\n\n* `target` : _JsonPointer, array or string, required_ &ndash; the path to be appended to the current path\n\n## Performance\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n_Consider this example code that queries the flickr API and prints results to the console:_\n\n```javascript\n'use strict';\n\nlet ptr = require('..'),\n  http = require('http'),\n  util = require('util');\n\n// A flickr feed, tags surf,pipeline\nlet feed = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=surf,pipeline&tagmode=all&format=json&jsoncallback=processResponse';\n\n// Compile/prepare the pointers...\nlet items = ptr.create('#/items');\nlet author = ptr.create('#/author');\nlet media = ptr.create('#/media/m');\n\nfunction processResponse(json) {\n  let data = items.get(json);\n\n  if (data && Array.isArray(data)) {\n    let images = data.reduce((acc, it) => {\n      // Using the prepared pointers to select parts...\n      acc.push({\n        author: author.get(it),\n        media: media.get(it)\n      });\n      return acc;\n    }, []);\n    console.log(util.inspect(images, false, 9));\n  }\n}\n\nhttp.get(feed, function(res) {\n  let data = '';\n\n  res.on('data', function(chunk) {\n    data += chunk;\n  });\n\n  res.on('end', function() {\n    // result is formatted as jsonp... this is for illustration only.\n    data = eval(data); // eslint-disable-line no-eval\n    processResponse(data);\n  });\n}).on('error', function(e) {\n  console.log('Got error: ' + e.message);\n});\n```\n\n> \\[[example/real-world.js](https://github.com/flitbit/json-ptr/blob/master/examples/real-world.js)]\n\n## Tests\n\nTests are written using [mocha](https://mochajs.org/) and [expect.js](https://github.com/Automattic/expect.js).\n\n```bash\nnpm test\n```\n\n... or ...\n\n```bash\nmocha\n```\n\n## Releases\n\n* 2019-09-14 &mdash; __1.2.0__\n  * Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n* 2019-03-10 &mdash; __1.1.2__\n  * Updated packages to remove critical security concern among dev dependencies'\n\n* 2016-07-26 &mdash; __1.0.1__\n  * Fixed a problem with the Babel configuration\n\n* 2016-01-12 &mdash; __1.0.0__\n  * Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n* 2016-01-02 &mdash; __0.3.0__\n  * Retooled for node 4+\n  * Better compiled pointers\n  * Unrolled recursive `.list` function\n  * Added `.map` function\n  * Fully linted\n  * Lots more tests and examples.\n  * Documented many previously undocumented features.\n\n* 2014-10-21 &mdash; __0.2.0__  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"da6e2a1aec2af01312dbc8a98e097489ea2985e8","scripts":{"ci":"npm run test","docs":"typedoc","lint":"eslint src --ext .js,.ts,.json","test":"nyc mocha src/**/*.spec.ts","build":"tsc --build tsconfig.json","clean":"rimraf dist .nyc_output coverage","pretest":"npm run build","prebuild":"npm run lint","preversion":"npm run build"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.13.4","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.16.0","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.0.0","bent":"^7.0.6","chai":"^4.2.0","mocha":"^7.0.1","eslint":"^6.8.0","lodash":"^4.17.15","rimraf":"^3.0.2","ts-node":"^8.6.2","typedoc":"^0.16.10","prettier":"^1.19.1","typescript":"^3.7.5","@types/bent":"^7.0.1","@types/chai":"^4.2.9","@types/mocha":"^7.0.1","@types/assert-plus":"^1.0.4","eslint-plugin-json":"^2.0.1","source-map-support":"^0.5.16","eslint-plugin-mocha":"^6.2.2","eslint-plugin-import":"^2.20.1","eslint-config-prettier":"^6.10.0","eslint-plugin-prettier":"^3.1.2","@typescript-eslint/parser":"^2.19.2","@typescript-eslint/eslint-plugin":"^2.19.2"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.0-ts.da6e2a1_1581958118794_0.6161804958961672","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.1-ts.64a7978.0":{"name":"json-ptr","version":"1.2.1-ts.64a7978.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.1-ts.64a7978.0","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"bd9160e5385cb97d6e61e3c7587c3da9cad52497","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.1-ts.64a7978.0.tgz","fileCount":43,"integrity":"sha512-nItP+8ycuw87Rj3GJ9hBpEjhNrpqM+Oi7ta7gudCIVYqLxJmAhQdAga5RVkLJMtazRCc2LqlILmUgXF3hbaXcg==","signatures":[{"sig":"MEUCIAIdq9RDAtATKLivIpTdYA/J5jB6UxoMGkHbMZiijdCTAiEA+9/q8dd6osPTwmPdsmoZd1fNZaWSBw+7PYKG70um2YY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":200512,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeU8VlCRA9TVsSAnZWagAASDQQAI8yc94u6t6AgUtHdLRY\nz+YyMJCQw9bV1/al6yW8SCNTl4h4n1O7hIQveR/59mysGfgURfhr0G3wzrBp\nFp8Xwxj/1KZLFC4dtruZwzgzdVlAQl+47C5se/5e8mO72iXUhZ5iE0YpSVFL\niKeR67Xtv+xGquPn3Wkt+orbJlCTIGp1mqJQTfTUqdmRx8GISfYY3gKGzZuV\nLDz5pwmyzCZ8vBbOY4Gd+c8/PqG/54YZq8FAYW1HcQpOc96FzxQkY68DFEMh\n6eU19Gs2eigrL1KIXzI7n1D14BXQD9CfzVtZ0LMvUW+wJVHD9xLCNBJyxAjI\nMUvcz8iTYFolh0h6BHEfFwAHkx/fTSaDjXKn2nJpZp8DUWUgB+AzDhY43QCL\nVoSuzGRv5nZw5+HayNVUTu/zv/XV7Ta5pUklKoPBri6pCDU/IhvwmJ46LnzN\nQexdTlT6cgf2W2XDcJeAGV/62beZ+nno8XPoGZn5EHeRe8wLJtL3VqX04wzL\nEAxISKJG++7LzF9CAUD7u2jS4iAhRk4UhkKEZFNJIaYZBsS5x+ik48YdsbH+\ngUnyLPhPMHE8qXgTE5/xhu6sxWslEKpMMZ4vHZxMYm+fdkO9jEH4Lt9r0vyI\njTxVKAefADBr2YxS1e6yyNjot5ijOVIQd0ey+aOOYhPja8aN1NBeQNf87nrU\nols1\r\n=ph5V\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this module a couple of years ago when I was unable to find what I considered a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\nSince there are a few npm modules for you to choose from, see [the section on performance later in this _readme_](#user-content-performance); you can use your own judgement as to which package you should employ.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Module API\n\n#### Classes\n\n* [`JsonPointer`](#user-content-jsonpointer-class) : _class_ &ndash; a convenience class for working with JSON pointers.\n* [`JsonReference`](#user-content-jsonreference-class) : _class_ &ndash; a convenience class for working with JSON references.\n\n#### Functions\n\n* [`.create(pointer)`](#user-content-createpointer)\n* [`.has(target,pointer)`](#user-content-hastargetpointer)\n* [`.get(target,pointer)`](#user-content-gettargetpointer)\n* [`.set(target,pointer,value,force)`](#user-content-settarget-pointer-value-force)\n* [`.flatten(target,fragmentId)`](#user-content-flattentarget-fragmentid)\n* [`.list(target,fragmentId)`](#user-content-listtarget-fragmentid)\n* [`.map(target,fragmentId)`](#user-content-maptarget-fragmentid)\n\nAll example code assumes data has this structure:\n\n```javascript\nconst data = {\n  legumes: [{\n    name: 'pinto beans',\n    unit: 'lbs',\n    instock: 4\n  }, {\n    name: 'lima beans',\n    unit: 'lbs',\n    instock: 21\n  }, {\n    name: 'black eyed peas',\n    unit: 'lbs',\n    instock: 13\n  }, {\n    name: 'plit peas',\n    unit: 'lbs',\n    instock: 8\n  }]\n}\n```\n\n#### .create(pointer: string | string[]): JsonPointer\n\nCreates an instance of the `JsonPointer` class.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* a new [`JsonPointer` instance](#user-content-jsonpointer-class)\n\n_example:_\n\n```ts\nconst pointer = JsonPointer.create('/legumes/0');\n// fragmentId: #/legumes/0\n```\n\n#### .has&lt;T>(target: T, pointer: string | string[] | JsonPointer): boolean\n\nDetermins whether the specified `target` has a value at the `pointer`'s path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n#### .get(target,pointer)\n\nGets a value from the specified `target` object at the `pointer`'s path\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nlet value = JsonPointer.get(data, '/legumes/1');\n// fragmentId: #/legumes/1\n```\n\n#### .set(target, pointer, value, force)\n\nSets the `value` at the specified `pointer` on the `target`. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_returns:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n_example:_\n\n```javascript\nlet prior = JsonPointer.set(data, '#/legumes/1/instock', 50);\n```\n\nexample force:\n\n```javascript\nlet data = {};\n\nJsonPointer.set(data, '#/peter/piper', 'man', true);\nJsonPointer.set(data, '#/peter/pan', 'boy', true);\nJsonPointer.set(data, '#/peter/pickle', 'dunno', true);\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"piper\": \"man\",\n    \"pan\": \"boy\",\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .list(target, fragmentId)\n\nLists all of the pointers available on the specified `target`.\n\n> See [a discussion about cycles in the object graph later in this document](#user-content-object-graph-cycles-and-recursion) if you have interest in how such is dealt with.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* an array of `pointer-value` pairs\n\n_example:_\n\n```javascript\nlet list = JsonPointer.list(data);\n```\n\n```json\n[ ...\n  {\n    \"pointer\": \"/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"pointer\": \"/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"pointer\": \"/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"pointer\": \"/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"pointer\": \"/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n_`fragmentId` example:_\n\n```javascript\nlet list = JsonPointer.list(data, true);\n```\n\n```json\n[ ...\n  {\n    \"fragmentId\": \"#/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n#### .flatten(target, fragmentId)\n\nFlattens an object graph (the `target`) into a single-level object of `pointer-value` pairs.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a flattened object of `property-value` pairs as properties.\n\n_example:_\n\n```javascript\nlet obj = JsonPointer.flatten(data, true);\n```\n\n```json\n{ ...\n  \"#/legumes/1/name\": \"lima beans\",\n  \"#/legumes/1/unit\": \"lbs\",\n  \"#/legumes/1/instock\": 21,\n  \"#/legumes/2/name\": \"black eyed peas\",\n  \"#/legumes/2/unit\": \"ea\",\n  \"#/legumes/2/instock\": 9340,\n  \"#/legumes/3/name\": \"plit peas\",\n  \"#/legumes/3/unit\": \"lbs\",\n  \"#/legumes/3/instock\": 8\n}\n```\n\n#### .map(target, fragmentId)\n\nFlattens an object graph (the `target`) into a [Map object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a Map object containing key-value pairs where keys are pointers.\n\n_example:_\n\n```javascript\nlet map = JsonPointer.map(data, true);\n\nfor (let it of map) {\n  console.log(JSON.stringify(it, null, '  '));\n}\n```\n\n```json\n...\n[\"#/legumes/0/name\", \"pinto beans\"]\n[\"#/legumes/0/unit\", \"lbs\"]\n[\"#/legumes/0/instock\", 4 ]\n[\"#/legumes/1/name\", \"lima beans\"]\n[\"#/legumes/1/unit\", \"lbs\"]\n[\"#/legumes/1/instock\", 21 ]\n[\"#/legumes/2/name\", \"black eyed peas\"]\n[\"#/legumes/2/unit\", \"ea\"]\n[\"#/legumes/2/instock\", 9340 ]\n[\"#/legumes/3/name\", \"plit peas\"]\n[\"#/legumes/3/unit\", \"lbs\"]\n[\"#/legumes/3/instock\", 8 ]\n```\n\n#### .decode(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = JsonPointer.decode('#/legumes/1/instock');\n```\n\n```json\n[ \"legumes\", \"1\", \"instock\" ]\n```\n\n#### decodePointer(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('/people/wilbur dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodePointer(path)\n\nEncodes the specified `path` as a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_arguments:_\n\n* `path` : _Array, required_ &ndash; an array of path segments\n\n_returns:_\n\n* A JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_example:_\n\n```javascript\nlet path = encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"/people/wilbur dongleworth/age\"\n```\n\n#### decodeUriFragmentIdentifier(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('#/people/wilbur%20dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodeUriFragmentIdentifier(path)\n\nEncodes the specified `path` as a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_arguments:_\n\n* `path` : _Array, required_ - an array of path segments\n\n_returns:_\n\n* A JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_example:_\n\n```javascript\nlet path = ptr.encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"#/people/wilbur%20dongleworth/age\"\n```\n\n### `JsonPointer` Class\n\nEncapsulates pointer related operations for a specified `pointer`.\n\n_properties:_\n\n* `.path` : _array_ &ndash; contains the pointer's path segements.\n* `.pointer` : _string_ &ndash; the pointer's [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5)\n* `.uriFragmentIdentifier` : _string_ &ndash; the pointer's [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_methods:_\n\n#### .has(target)\n\nDetermins whether the specified `target` has a value at the pointer's path.\n\n#### .get(target)\n\nLooks up the specified `target`'s value at the pointer's path if such exists; otherwise _undefined_.\n\n#### .set(target, value, force)\n\nSets the specified `target`'s value at the pointer's path, if such exists.If `force` is specified (_truthy_), missing path segments are created and the value is always set at the pointer's path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_result:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n#### .concat(target)\n\nCreates new pointer appending target to the current pointer's path\n\n_arguments:_\n\n* `target` : _JsonPointer, array or string, required_ &ndash; the path to be appended to the current path\n\n## Performance\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n_Consider this example code that queries the flickr API and prints results to the console:_\n\n```javascript\n'use strict';\n\nlet ptr = require('..'),\n  http = require('http'),\n  util = require('util');\n\n// A flickr feed, tags surf,pipeline\nlet feed = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=surf,pipeline&tagmode=all&format=json&jsoncallback=processResponse';\n\n// Compile/prepare the pointers...\nlet items = ptr.create('#/items');\nlet author = ptr.create('#/author');\nlet media = ptr.create('#/media/m');\n\nfunction processResponse(json) {\n  let data = items.get(json);\n\n  if (data && Array.isArray(data)) {\n    let images = data.reduce((acc, it) => {\n      // Using the prepared pointers to select parts...\n      acc.push({\n        author: author.get(it),\n        media: media.get(it)\n      });\n      return acc;\n    }, []);\n    console.log(util.inspect(images, false, 9));\n  }\n}\n\nhttp.get(feed, function(res) {\n  let data = '';\n\n  res.on('data', function(chunk) {\n    data += chunk;\n  });\n\n  res.on('end', function() {\n    // result is formatted as jsonp... this is for illustration only.\n    data = eval(data); // eslint-disable-line no-eval\n    processResponse(data);\n  });\n}).on('error', function(e) {\n  console.log('Got error: ' + e.message);\n});\n```\n\n> \\[[example/real-world.js](https://github.com/flitbit/json-ptr/blob/master/examples/real-world.js)]\n\n## Tests\n\nTests are written using [mocha](https://mochajs.org/) and [expect.js](https://github.com/Automattic/expect.js).\n\n```bash\nnpm test\n```\n\n... or ...\n\n```bash\nmocha\n```\n\n## Releases\n\n* 2019-09-14 &mdash; __1.2.0__\n  * Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n* 2019-03-10 &mdash; __1.1.2__\n  * Updated packages to remove critical security concern among dev dependencies'\n\n* 2016-07-26 &mdash; __1.0.1__\n  * Fixed a problem with the Babel configuration\n\n* 2016-01-12 &mdash; __1.0.0__\n  * Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n* 2016-01-02 &mdash; __0.3.0__\n  * Retooled for node 4+\n  * Better compiled pointers\n  * Unrolled recursive `.list` function\n  * Added `.map` function\n  * Fully linted\n  * Lots more tests and examples.\n  * Documented many previously undocumented features.\n\n* 2014-10-21 &mdash; __0.2.0__  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"64a797803b050e0551ed926c06f36b2419aebba6","scripts":{"ci":"npm run test","docs":"typedoc","lint":"eslint src --ext .js,.ts,.json","test":"nyc mocha src/**/*.spec.ts","build":"tsc --build tsconfig.json","clean":"rimraf dist .nyc_output coverage","pretest":"npm run build","prebuild":"npm run lint","preversion":"npm run build"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.13.4","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.0.0","bent":"^7.0.6","chai":"^4.2.0","mocha":"^7.0.1","eslint":"^6.8.0","lodash":"^4.17.15","rimraf":"^3.0.2","ts-node":"^8.6.2","typedoc":"^0.16.10","prettier":"^1.19.1","typescript":"^3.7.5","@types/bent":"^7.0.1","@types/chai":"^4.2.9","@types/mocha":"^7.0.1","@types/assert-plus":"^1.0.4","eslint-plugin-json":"^2.0.1","source-map-support":"^0.5.16","eslint-plugin-mocha":"^6.2.2","eslint-plugin-import":"^2.20.1","eslint-config-prettier":"^6.10.0","eslint-plugin-prettier":"^3.1.2","@typescript-eslint/parser":"^2.19.2","@typescript-eslint/eslint-plugin":"^2.19.2"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.1-ts.64a7978.0_1582548325166_0.8705262260516013","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.1-ts.33951c4.0":{"name":"json-ptr","version":"1.2.1-ts.33951c4.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.1-ts.33951c4.0","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"d8266f0a949359b27aed3dad68a7a36156dcc2a8","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.1-ts.33951c4.0.tgz","fileCount":47,"integrity":"sha512-fFGUrr7a2pr9Toyd86gMT9EliuNhkxR3Dem8BJ/nDrZ1KxXAKHCXk/1VYhs9zEP9q7oOKkhGlzKRBTgUfs+pPw==","signatures":[{"sig":"MEUCIQCAhpKs2V8xS10U6zN5T4dTzBUmSR/iHZkHg3FjkG5/LwIgVEZkneC/m+OELSDSYO3i8hbPJ3c4Me74zWHKHYDZfIg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":200974,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZRItCRA9TVsSAnZWagAAS7UQAIyFC+zQBAmPY1V37+A3\nZv9CP+2pNKWZ0zOOjez/m0DdZWAsYeLZ4o/At4UC45GEcvTefwV0dCwyiUkb\njEk4SOpmMA0AWLX1NIxje14+uwN6Ge7Jq1RHM/C8+VGdTC0YjeqZcG1jH6vE\n1CsKPB7z2J+INkH5M0nOy7NtAG3aCI72H60PlRjkVWOOnn54XjIrx+wCgoue\nSxcPvOjCVvfkqnxyRntgt4fhDnxdUOiaSiFcI8tJpImgAIZ1/dwNHLK5wfme\nONfavu/TqWV1Ky3bA9U5eW+J8r5/A/CQqrwHnT5HXCPtZAchlLo+ruQM4Y+x\n4pDw24p0415L/ZbaaZ4guzccE2YmktOOC/0w0Rnznixbx0IrWFajM57W/14H\ncypiAWJBtvhYTCfO6/RlSfnk+52n0gXBUSuhDQTXIe5cXshMZ8Qe/JE/kZfd\n7/HD/h+D8mK3txRwo5M0r025FZ9snUYkhckm3pRL+IBLRQHSUGmqwEC9SvV3\naxPRbMI1NdZFO0IaUb1j1tVZSq/5vByWiPNfCGrdhQOaMc3/MO7h1QBIuiQW\njvXwByBZbaZopuedBq1shTPT3YsbGo43vn+1L2+b1ug/hfX+oCazq5EWY7ju\nW1bWHH3uhPiCq9ggvcgP/LfcKrUdi8k8DSixk/XLHdzohj6DSNHH0mZ3m8ng\nTX7g\r\n=UGra\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this module a couple of years ago when I was unable to find what I considered a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\nSince there are a few npm modules for you to choose from, see [the section on performance later in this _readme_](#user-content-performance); you can use your own judgement as to which package you should employ.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Module API\n\n#### Classes\n\n* [`JsonPointer`](#user-content-jsonpointer-class) : _class_ &ndash; a convenience class for working with JSON pointers.\n* [`JsonReference`](#user-content-jsonreference-class) : _class_ &ndash; a convenience class for working with JSON references.\n\n#### Functions\n\n* [`.create(pointer)`](#user-content-createpointer)\n* [`.has(target,pointer)`](#user-content-hastargetpointer)\n* [`.get(target,pointer)`](#user-content-gettargetpointer)\n* [`.set(target,pointer,value,force)`](#user-content-settarget-pointer-value-force)\n* [`.flatten(target,fragmentId)`](#user-content-flattentarget-fragmentid)\n* [`.list(target,fragmentId)`](#user-content-listtarget-fragmentid)\n* [`.map(target,fragmentId)`](#user-content-maptarget-fragmentid)\n\nAll example code assumes data has this structure:\n\n```javascript\nconst data = {\n  legumes: [{\n    name: 'pinto beans',\n    unit: 'lbs',\n    instock: 4\n  }, {\n    name: 'lima beans',\n    unit: 'lbs',\n    instock: 21\n  }, {\n    name: 'black eyed peas',\n    unit: 'lbs',\n    instock: 13\n  }, {\n    name: 'plit peas',\n    unit: 'lbs',\n    instock: 8\n  }]\n}\n```\n\n#### .create(pointer: string | string[]): JsonPointer\n\nCreates an instance of the `JsonPointer` class.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* a new [`JsonPointer` instance](#user-content-jsonpointer-class)\n\n_example:_\n\n```ts\nconst pointer = JsonPointer.create('/legumes/0');\n// fragmentId: #/legumes/0\n```\n\n#### .has&lt;T>(target: T, pointer: string | string[] | JsonPointer): boolean\n\nDetermins whether the specified `target` has a value at the `pointer`'s path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n#### .get(target,pointer)\n\nGets a value from the specified `target` object at the `pointer`'s path\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nlet value = JsonPointer.get(data, '/legumes/1');\n// fragmentId: #/legumes/1\n```\n\n#### .set(target, pointer, value, force)\n\nSets the `value` at the specified `pointer` on the `target`. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_returns:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n_example:_\n\n```javascript\nlet prior = JsonPointer.set(data, '#/legumes/1/instock', 50);\n```\n\nexample force:\n\n```javascript\nlet data = {};\n\nJsonPointer.set(data, '#/peter/piper', 'man', true);\nJsonPointer.set(data, '#/peter/pan', 'boy', true);\nJsonPointer.set(data, '#/peter/pickle', 'dunno', true);\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"piper\": \"man\",\n    \"pan\": \"boy\",\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .list(target, fragmentId)\n\nLists all of the pointers available on the specified `target`.\n\n> See [a discussion about cycles in the object graph later in this document](#user-content-object-graph-cycles-and-recursion) if you have interest in how such is dealt with.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* an array of `pointer-value` pairs\n\n_example:_\n\n```javascript\nlet list = JsonPointer.list(data);\n```\n\n```json\n[ ...\n  {\n    \"pointer\": \"/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"pointer\": \"/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"pointer\": \"/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"pointer\": \"/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"pointer\": \"/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n_`fragmentId` example:_\n\n```javascript\nlet list = JsonPointer.list(data, true);\n```\n\n```json\n[ ...\n  {\n    \"fragmentId\": \"#/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n#### .flatten(target, fragmentId)\n\nFlattens an object graph (the `target`) into a single-level object of `pointer-value` pairs.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a flattened object of `property-value` pairs as properties.\n\n_example:_\n\n```javascript\nlet obj = JsonPointer.flatten(data, true);\n```\n\n```json\n{ ...\n  \"#/legumes/1/name\": \"lima beans\",\n  \"#/legumes/1/unit\": \"lbs\",\n  \"#/legumes/1/instock\": 21,\n  \"#/legumes/2/name\": \"black eyed peas\",\n  \"#/legumes/2/unit\": \"ea\",\n  \"#/legumes/2/instock\": 9340,\n  \"#/legumes/3/name\": \"plit peas\",\n  \"#/legumes/3/unit\": \"lbs\",\n  \"#/legumes/3/instock\": 8\n}\n```\n\n#### .map(target, fragmentId)\n\nFlattens an object graph (the `target`) into a [Map object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a Map object containing key-value pairs where keys are pointers.\n\n_example:_\n\n```javascript\nlet map = JsonPointer.map(data, true);\n\nfor (let it of map) {\n  console.log(JSON.stringify(it, null, '  '));\n}\n```\n\n```json\n...\n[\"#/legumes/0/name\", \"pinto beans\"]\n[\"#/legumes/0/unit\", \"lbs\"]\n[\"#/legumes/0/instock\", 4 ]\n[\"#/legumes/1/name\", \"lima beans\"]\n[\"#/legumes/1/unit\", \"lbs\"]\n[\"#/legumes/1/instock\", 21 ]\n[\"#/legumes/2/name\", \"black eyed peas\"]\n[\"#/legumes/2/unit\", \"ea\"]\n[\"#/legumes/2/instock\", 9340 ]\n[\"#/legumes/3/name\", \"plit peas\"]\n[\"#/legumes/3/unit\", \"lbs\"]\n[\"#/legumes/3/instock\", 8 ]\n```\n\n#### .decode(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = JsonPointer.decode('#/legumes/1/instock');\n```\n\n```json\n[ \"legumes\", \"1\", \"instock\" ]\n```\n\n#### decodePointer(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('/people/wilbur dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodePointer(path)\n\nEncodes the specified `path` as a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_arguments:_\n\n* `path` : _Array, required_ &ndash; an array of path segments\n\n_returns:_\n\n* A JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_example:_\n\n```javascript\nlet path = encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"/people/wilbur dongleworth/age\"\n```\n\n#### decodeUriFragmentIdentifier(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('#/people/wilbur%20dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodeUriFragmentIdentifier(path)\n\nEncodes the specified `path` as a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_arguments:_\n\n* `path` : _Array, required_ - an array of path segments\n\n_returns:_\n\n* A JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_example:_\n\n```javascript\nlet path = ptr.encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"#/people/wilbur%20dongleworth/age\"\n```\n\n### `JsonPointer` Class\n\nEncapsulates pointer related operations for a specified `pointer`.\n\n_properties:_\n\n* `.path` : _array_ &ndash; contains the pointer's path segements.\n* `.pointer` : _string_ &ndash; the pointer's [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5)\n* `.uriFragmentIdentifier` : _string_ &ndash; the pointer's [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_methods:_\n\n#### .has(target)\n\nDetermins whether the specified `target` has a value at the pointer's path.\n\n#### .get(target)\n\nLooks up the specified `target`'s value at the pointer's path if such exists; otherwise _undefined_.\n\n#### .set(target, value, force)\n\nSets the specified `target`'s value at the pointer's path, if such exists.If `force` is specified (_truthy_), missing path segments are created and the value is always set at the pointer's path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_result:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n#### .concat(target)\n\nCreates new pointer appending target to the current pointer's path\n\n_arguments:_\n\n* `target` : _JsonPointer, array or string, required_ &ndash; the path to be appended to the current path\n\n## Performance\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n_Consider this example code that queries the flickr API and prints results to the console:_\n\n```javascript\n'use strict';\n\nlet ptr = require('..'),\n  http = require('http'),\n  util = require('util');\n\n// A flickr feed, tags surf,pipeline\nlet feed = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=surf,pipeline&tagmode=all&format=json&jsoncallback=processResponse';\n\n// Compile/prepare the pointers...\nlet items = ptr.create('#/items');\nlet author = ptr.create('#/author');\nlet media = ptr.create('#/media/m');\n\nfunction processResponse(json) {\n  let data = items.get(json);\n\n  if (data && Array.isArray(data)) {\n    let images = data.reduce((acc, it) => {\n      // Using the prepared pointers to select parts...\n      acc.push({\n        author: author.get(it),\n        media: media.get(it)\n      });\n      return acc;\n    }, []);\n    console.log(util.inspect(images, false, 9));\n  }\n}\n\nhttp.get(feed, function(res) {\n  let data = '';\n\n  res.on('data', function(chunk) {\n    data += chunk;\n  });\n\n  res.on('end', function() {\n    // result is formatted as jsonp... this is for illustration only.\n    data = eval(data); // eslint-disable-line no-eval\n    processResponse(data);\n  });\n}).on('error', function(e) {\n  console.log('Got error: ' + e.message);\n});\n```\n\n> \\[[example/real-world.js](https://github.com/flitbit/json-ptr/blob/master/examples/real-world.js)]\n\n## Tests\n\nTests are written using [mocha](https://mochajs.org/) and [expect.js](https://github.com/Automattic/expect.js).\n\n```bash\nnpm test\n```\n\n... or ...\n\n```bash\nmocha\n```\n\n## Releases\n\n* 2019-09-14 &mdash; __1.2.0__\n  * Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n* 2019-03-10 &mdash; __1.1.2__\n  * Updated packages to remove critical security concern among dev dependencies'\n\n* 2016-07-26 &mdash; __1.0.1__\n  * Fixed a problem with the Babel configuration\n\n* 2016-01-12 &mdash; __1.0.0__\n  * Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n* 2016-01-02 &mdash; __0.3.0__\n  * Retooled for node 4+\n  * Better compiled pointers\n  * Unrolled recursive `.list` function\n  * Added `.map` function\n  * Fully linted\n  * Lots more tests and examples.\n  * Documented many previously undocumented features.\n\n* 2014-10-21 &mdash; __0.2.0__  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"33951c4f7cedda74dd48286acbaafdf3529bd0e3","scripts":{"ci":"npm run test","docs":"typedoc","lint":"eslint src --ext .js,.ts,.json","test":"nyc mocha src/**/*.spec.ts","build":"tsc --build tsconfig.json","clean":"rimraf dist .nyc_output coverage","pretest":"npm run build","prebuild":"npm run lint","preversion":"npm run build"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.13.4","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.0.0","bent":"^7.0.6","chai":"^4.2.0","mocha":"^7.0.1","eslint":"^6.8.0","lodash":"^4.17.15","rimraf":"^3.0.2","ts-node":"^8.6.2","typedoc":"^0.16.10","prettier":"^1.19.1","typescript":"^3.7.5","@types/bent":"^7.0.1","@types/chai":"^4.2.9","@types/mocha":"^7.0.1","@types/assert-plus":"^1.0.4","eslint-plugin-json":"^2.0.1","source-map-support":"^0.5.16","eslint-plugin-mocha":"^6.2.2","eslint-plugin-import":"^2.20.1","eslint-config-prettier":"^6.10.0","eslint-plugin-prettier":"^3.1.2","@typescript-eslint/parser":"^2.19.2","@typescript-eslint/eslint-plugin":"^2.19.2"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.1-ts.33951c4.0_1583682092879_0.8680136444663329","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.1-ts.c739a2e.0":{"name":"json-ptr","version":"1.2.1-ts.c739a2e.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.1-ts.c739a2e.0","maintainers":[{"name":"flitbit","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"8e11a2429fac309da59b828c78b89775585316ef","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.1-ts.c739a2e.0.tgz","fileCount":47,"integrity":"sha512-X9jm6CTuHqOkr6WkDk7HlU9zqaOYsteuV9jK7dlu4sVYu4EjROHtB9nTTtPTAwsjSazprt95NXRH0z2ZGI+bnA==","signatures":[{"sig":"MEQCIAlPlGMgoJqm6ZtONKxCtfM39daW4TWPygw9V/SsmTzWAiAUyb4/+kQcrqpvp7oWz6sY24pOFuSIbxeQD7l+gJw0zQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":202633,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJef2vRCRA9TVsSAnZWagAACQkP/jrvM5m8NrLJsTdc37sC\nooQGGj0X1s9+popwFrp4+sKV1ugcUIHDmk4l+R1LPGt+PYvz0WKJUB55dc0z\nI5rJYvas1DywYt+y6+2Qiay0mdTArmsAIocIBHUkcMtDknBXhPyDCEssKzzo\nORbyG2+9kYdH2NSN+q+TARdezjuKAz6w/N4KQzt4u3CycUhoeIQwZkf9Tjtd\npNMJGQ6WVLwh60JzW65aAGxYi+Z5/GMOyR+14S5UiO0HkzwhqhrXz8UPto+s\n66PK+Zi1flBUjepWSDykCObqnm2GhQJYJp3NCoU2lBfFzMFMC5gGB0iyijaV\nOXwj4pJ66U9MH3ENmiIqn2iZhZKaYkw9/rD2cv1tINvjcFKKAqBE8KDshBw5\nGupc4tqDehv4dPFepnNuk9zs9tF1dvu+tOte7/GAgLoAIE4xNFgfqIUS2ibd\nF9ZHPMozXyxwM5FQPnxpGPmbjyDxIMx6ek3+NJexy3rs2S72pSy4QMguv/cs\naCLUMmxsAAunp4ALLTMGb7VP6bDBOdSZWAF1ONmX04J9pVa8vGiqTb2DfNhN\nL4LSwrw/xN2cU3hPOpQ3mvzNr2PPl09TvDmak1uJ0xIBFa5p5cfC8oFWOLFT\nFUYO36vavTBicDA20NPUTfbaX1/VR5yMlLRwo8OaSMqfo31+wckfFfq1LUC2\nIGbA\r\n=0k0f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this module a couple of years ago when I was unable to find what I considered a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\nSince there are a few npm modules for you to choose from, see [the section on performance later in this _readme_](#user-content-performance); you can use your own judgement as to which package you should employ.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Module API\n\n#### Classes\n\n* [`JsonPointer`](#user-content-jsonpointer-class) : _class_ &ndash; a convenience class for working with JSON pointers.\n* [`JsonReference`](#user-content-jsonreference-class) : _class_ &ndash; a convenience class for working with JSON references.\n\n#### Functions\n\n* [`.create(pointer)`](#user-content-createpointer)\n* [`.has(target,pointer)`](#user-content-hastargetpointer)\n* [`.get(target,pointer)`](#user-content-gettargetpointer)\n* [`.set(target,pointer,value,force)`](#user-content-settarget-pointer-value-force)\n* [`.flatten(target,fragmentId)`](#user-content-flattentarget-fragmentid)\n* [`.list(target,fragmentId)`](#user-content-listtarget-fragmentid)\n* [`.map(target,fragmentId)`](#user-content-maptarget-fragmentid)\n\nAll example code assumes data has this structure:\n\n```javascript\nconst data = {\n  legumes: [{\n    name: 'pinto beans',\n    unit: 'lbs',\n    instock: 4\n  }, {\n    name: 'lima beans',\n    unit: 'lbs',\n    instock: 21\n  }, {\n    name: 'black eyed peas',\n    unit: 'lbs',\n    instock: 13\n  }, {\n    name: 'plit peas',\n    unit: 'lbs',\n    instock: 8\n  }]\n}\n```\n\n#### .create(pointer: string | string[]): JsonPointer\n\nCreates an instance of the `JsonPointer` class.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* a new [`JsonPointer` instance](#user-content-jsonpointer-class)\n\n_example:_\n\n```ts\nconst pointer = JsonPointer.create('/legumes/0');\n// fragmentId: #/legumes/0\n```\n\n#### .has&lt;T>(target: T, pointer: string | string[] | JsonPointer): boolean\n\nDetermins whether the specified `target` has a value at the `pointer`'s path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n#### .get(target,pointer)\n\nGets a value from the specified `target` object at the `pointer`'s path\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nlet value = JsonPointer.get(data, '/legumes/1');\n// fragmentId: #/legumes/1\n```\n\n#### .set(target, pointer, value, force)\n\nSets the `value` at the specified `pointer` on the `target`. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_returns:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n_example:_\n\n```javascript\nlet prior = JsonPointer.set(data, '#/legumes/1/instock', 50);\n```\n\nexample force:\n\n```javascript\nlet data = {};\n\nJsonPointer.set(data, '#/peter/piper', 'man', true);\nJsonPointer.set(data, '#/peter/pan', 'boy', true);\nJsonPointer.set(data, '#/peter/pickle', 'dunno', true);\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"piper\": \"man\",\n    \"pan\": \"boy\",\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .list(target, fragmentId)\n\nLists all of the pointers available on the specified `target`.\n\n> See [a discussion about cycles in the object graph later in this document](#user-content-object-graph-cycles-and-recursion) if you have interest in how such is dealt with.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* an array of `pointer-value` pairs\n\n_example:_\n\n```javascript\nlet list = JsonPointer.list(data);\n```\n\n```json\n[ ...\n  {\n    \"pointer\": \"/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"pointer\": \"/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"pointer\": \"/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"pointer\": \"/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"pointer\": \"/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n_`fragmentId` example:_\n\n```javascript\nlet list = JsonPointer.list(data, true);\n```\n\n```json\n[ ...\n  {\n    \"fragmentId\": \"#/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n#### .flatten(target, fragmentId)\n\nFlattens an object graph (the `target`) into a single-level object of `pointer-value` pairs.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a flattened object of `property-value` pairs as properties.\n\n_example:_\n\n```javascript\nlet obj = JsonPointer.flatten(data, true);\n```\n\n```json\n{ ...\n  \"#/legumes/1/name\": \"lima beans\",\n  \"#/legumes/1/unit\": \"lbs\",\n  \"#/legumes/1/instock\": 21,\n  \"#/legumes/2/name\": \"black eyed peas\",\n  \"#/legumes/2/unit\": \"ea\",\n  \"#/legumes/2/instock\": 9340,\n  \"#/legumes/3/name\": \"plit peas\",\n  \"#/legumes/3/unit\": \"lbs\",\n  \"#/legumes/3/instock\": 8\n}\n```\n\n#### .map(target, fragmentId)\n\nFlattens an object graph (the `target`) into a [Map object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a Map object containing key-value pairs where keys are pointers.\n\n_example:_\n\n```javascript\nlet map = JsonPointer.map(data, true);\n\nfor (let it of map) {\n  console.log(JSON.stringify(it, null, '  '));\n}\n```\n\n```json\n...\n[\"#/legumes/0/name\", \"pinto beans\"]\n[\"#/legumes/0/unit\", \"lbs\"]\n[\"#/legumes/0/instock\", 4 ]\n[\"#/legumes/1/name\", \"lima beans\"]\n[\"#/legumes/1/unit\", \"lbs\"]\n[\"#/legumes/1/instock\", 21 ]\n[\"#/legumes/2/name\", \"black eyed peas\"]\n[\"#/legumes/2/unit\", \"ea\"]\n[\"#/legumes/2/instock\", 9340 ]\n[\"#/legumes/3/name\", \"plit peas\"]\n[\"#/legumes/3/unit\", \"lbs\"]\n[\"#/legumes/3/instock\", 8 ]\n```\n\n#### .decode(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = JsonPointer.decode('#/legumes/1/instock');\n```\n\n```json\n[ \"legumes\", \"1\", \"instock\" ]\n```\n\n#### decodePointer(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('/people/wilbur dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodePointer(path)\n\nEncodes the specified `path` as a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_arguments:_\n\n* `path` : _Array, required_ &ndash; an array of path segments\n\n_returns:_\n\n* A JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_example:_\n\n```javascript\nlet path = encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"/people/wilbur dongleworth/age\"\n```\n\n#### decodeUriFragmentIdentifier(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('#/people/wilbur%20dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodeUriFragmentIdentifier(path)\n\nEncodes the specified `path` as a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_arguments:_\n\n* `path` : _Array, required_ - an array of path segments\n\n_returns:_\n\n* A JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_example:_\n\n```javascript\nlet path = ptr.encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"#/people/wilbur%20dongleworth/age\"\n```\n\n### `JsonPointer` Class\n\nEncapsulates pointer related operations for a specified `pointer`.\n\n_properties:_\n\n* `.path` : _array_ &ndash; contains the pointer's path segements.\n* `.pointer` : _string_ &ndash; the pointer's [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5)\n* `.uriFragmentIdentifier` : _string_ &ndash; the pointer's [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_methods:_\n\n#### .has(target)\n\nDetermins whether the specified `target` has a value at the pointer's path.\n\n#### .get(target)\n\nLooks up the specified `target`'s value at the pointer's path if such exists; otherwise _undefined_.\n\n#### .set(target, value, force)\n\nSets the specified `target`'s value at the pointer's path, if such exists.If `force` is specified (_truthy_), missing path segments are created and the value is always set at the pointer's path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_result:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n#### .concat(target)\n\nCreates new pointer appending target to the current pointer's path\n\n_arguments:_\n\n* `target` : _JsonPointer, array or string, required_ &ndash; the path to be appended to the current path\n\n## Performance\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n_Consider this example code that queries the flickr API and prints results to the console:_\n\n```javascript\n'use strict';\n\nlet ptr = require('..'),\n  http = require('http'),\n  util = require('util');\n\n// A flickr feed, tags surf,pipeline\nlet feed = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=surf,pipeline&tagmode=all&format=json&jsoncallback=processResponse';\n\n// Compile/prepare the pointers...\nlet items = ptr.create('#/items');\nlet author = ptr.create('#/author');\nlet media = ptr.create('#/media/m');\n\nfunction processResponse(json) {\n  let data = items.get(json);\n\n  if (data && Array.isArray(data)) {\n    let images = data.reduce((acc, it) => {\n      // Using the prepared pointers to select parts...\n      acc.push({\n        author: author.get(it),\n        media: media.get(it)\n      });\n      return acc;\n    }, []);\n    console.log(util.inspect(images, false, 9));\n  }\n}\n\nhttp.get(feed, function(res) {\n  let data = '';\n\n  res.on('data', function(chunk) {\n    data += chunk;\n  });\n\n  res.on('end', function() {\n    // result is formatted as jsonp... this is for illustration only.\n    data = eval(data); // eslint-disable-line no-eval\n    processResponse(data);\n  });\n}).on('error', function(e) {\n  console.log('Got error: ' + e.message);\n});\n```\n\n> \\[[example/real-world.js](https://github.com/flitbit/json-ptr/blob/master/examples/real-world.js)]\n\n## Tests\n\nTests are written using [mocha](https://mochajs.org/) and [expect.js](https://github.com/Automattic/expect.js).\n\n```bash\nnpm test\n```\n\n... or ...\n\n```bash\nmocha\n```\n\n## Releases\n\n* 2019-09-14 &mdash; __1.2.0__\n  * Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n* 2019-03-10 &mdash; __1.1.2__\n  * Updated packages to remove critical security concern among dev dependencies'\n\n* 2016-07-26 &mdash; __1.0.1__\n  * Fixed a problem with the Babel configuration\n\n* 2016-01-12 &mdash; __1.0.0__\n  * Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n* 2016-01-02 &mdash; __0.3.0__\n  * Retooled for node 4+\n  * Better compiled pointers\n  * Unrolled recursive `.list` function\n  * Added `.map` function\n  * Fully linted\n  * Lots more tests and examples.\n  * Documented many previously undocumented features.\n\n* 2014-10-21 &mdash; __0.2.0__  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"c739a2efe94730e62a67efa5149f0b7fd6725c36","scripts":{"ci":"npm run test","docs":"typedoc","lint":"eslint src --ext .js,.ts,.json","test":"nyc mocha src/**/*.spec.ts","build":"tsc --build tsconfig.json","clean":"rimraf dist .nyc_output coverage","pretest":"npm run build","prebuild":"npm run lint","preversion":"npm run build"},"_npmUser":{"name":"flitbit","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.13.4","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.16.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.0.0","bent":"^7.1.2","chai":"^4.2.0","mocha":"^7.1.1","eslint":"^6.8.0","lodash":"^4.17.15","rimraf":"^3.0.2","ts-node":"^8.8.1","typedoc":"^0.17.3","prettier":"^2.0.2","typescript":"^3.8.3","@types/bent":"^7.0.1","@types/chai":"^4.2.11","@types/mocha":"^7.0.2","@types/assert-plus":"^1.0.4","eslint-plugin-json":"^2.1.1","source-map-support":"^0.5.16","eslint-plugin-mocha":"^6.3.0","eslint-plugin-import":"^2.20.1","eslint-config-prettier":"^6.10.1","eslint-plugin-prettier":"^3.1.2","@typescript-eslint/parser":"^2.25.0","@typescript-eslint/eslint-plugin":"^2.25.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.1-ts.c739a2e.0_1585408977169_0.8429785212549405","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.1-ts.93dc79c.0":{"name":"json-ptr","version":"1.2.1-ts.93dc79c.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.1-ts.93dc79c.0","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"70c306a12f249614cda5c61311e807546d207662","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.1-ts.93dc79c.0.tgz","fileCount":3,"integrity":"sha512-BxUtRbJe4NABQr43RxRL0f/L9wXU5FERsEPtSVm26dNWVNAHOkxvIyR9MnvnevR+o1SS96vSWVeeKpTQw+9K9w==","signatures":[{"sig":"MEUCIAN5v8ZdHVjSSh2HvMplAUFLopnPa+dQziGE61hi7OtJAiEAxEBy2X6rBUAlWGt9QtZsPVX6fsLQX8oePCmRPRBTqEs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":20942,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCGvcCRA9TVsSAnZWagAAr58P/iTzHgwf0KrrFGkyoqMa\nRaHK9eMreyBXDqYfcfQW6Lf1pdxDyOOfcexwhN1EzNuc6Ff5D3AXojfKaHcL\nl8W4EWNhpO3a7M48begjyzhcZGcrjzYIbg4AuM1vZ5Owtr3BDN0sWyoyGr5n\nVNYlZZdNOVr2ABvv0PNFrd/ssyuZpmNnSWZ07zelnIaioVFTP8bvSU9KR80z\nUm48EVgi2Q+Yccbi81JyXgbetkuQHePngdyuCfZS4INkJx5hQGBZxNibCVjq\nKqGdmIBTZXPMv7MBRmweaFVIvW9ieJOW5BQoXyVI2vm+4Uq/wLmjRiDSAw9U\nvA1z+rd4fs2aGl3DO7JE9q2JCXf+vyvOzcmCLo5p2TKDKw7H6gAIF+xWcsih\nbhqq5bSbmNy8ZFyDOXcFUOJukX0U+NVfOQcQyP03N/RKA9EImbJ6ADmaK5DK\ngmhKgj2Zi7VnBM+AraB3e+JZ0ISEeH8JEYaEyBBwgpAKEowMgYEmoKWbbfFA\nk1R6g7h+fRsFLGyoFYtxHR5RU92JVnJTbY1xeqG83rZzGiMvHUOr37hKBR5o\nrJ+QhGZFSH09tBbf90FXOV+dhEnzT0AaGsbli2kiGXbjYgNiUJ1TXASpQDYO\nfUm1JhlOGYNPiuyEvJ8FHDL8EpY4PYuGyfBCl/mP6F4/z33X3unACsGH/mKh\nyOtL\r\n=lg+F\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this module a couple of years ago when I was unable to find what I considered a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\nSince there are a few npm modules for you to choose from, see [the section on performance later in this _readme_](#user-content-performance); you can use your own judgement as to which package you should employ.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Module API\n\n#### Classes\n\n* [`JsonPointer`](#user-content-jsonpointer-class) : _class_ &ndash; a convenience class for working with JSON pointers.\n* [`JsonReference`](#user-content-jsonreference-class) : _class_ &ndash; a convenience class for working with JSON references.\n\n#### Functions\n\n* [`.create(pointer)`](#user-content-createpointer)\n* [`.has(target,pointer)`](#user-content-hastargetpointer)\n* [`.get(target,pointer)`](#user-content-gettargetpointer)\n* [`.set(target,pointer,value,force)`](#user-content-settarget-pointer-value-force)\n* [`.flatten(target,fragmentId)`](#user-content-flattentarget-fragmentid)\n* [`.list(target,fragmentId)`](#user-content-listtarget-fragmentid)\n* [`.map(target,fragmentId)`](#user-content-maptarget-fragmentid)\n\nAll example code assumes data has this structure:\n\n```javascript\nconst data = {\n  legumes: [{\n    name: 'pinto beans',\n    unit: 'lbs',\n    instock: 4\n  }, {\n    name: 'lima beans',\n    unit: 'lbs',\n    instock: 21\n  }, {\n    name: 'black eyed peas',\n    unit: 'lbs',\n    instock: 13\n  }, {\n    name: 'plit peas',\n    unit: 'lbs',\n    instock: 8\n  }]\n}\n```\n\n#### .create(pointer: string | string[]): JsonPointer\n\nCreates an instance of the `JsonPointer` class.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* a new [`JsonPointer` instance](#user-content-jsonpointer-class)\n\n_example:_\n\n```ts\nconst pointer = JsonPointer.create('/legumes/0');\n// fragmentId: #/legumes/0\n```\n\n#### .has&lt;T>(target: T, pointer: string | string[] | JsonPointer): boolean\n\nDetermins whether the specified `target` has a value at the `pointer`'s path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n#### .get(target,pointer)\n\nGets a value from the specified `target` object at the `pointer`'s path\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* the dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nlet value = JsonPointer.get(data, '/legumes/1');\n// fragmentId: #/legumes/1\n```\n\n#### .set(target, pointer, value, force)\n\nSets the `value` at the specified `pointer` on the `target`. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_returns:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n_example:_\n\n```javascript\nlet prior = JsonPointer.set(data, '#/legumes/1/instock', 50);\n```\n\nexample force:\n\n```javascript\nlet data = {};\n\nJsonPointer.set(data, '#/peter/piper', 'man', true);\nJsonPointer.set(data, '#/peter/pan', 'boy', true);\nJsonPointer.set(data, '#/peter/pickle', 'dunno', true);\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"piper\": \"man\",\n    \"pan\": \"boy\",\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .unset(target, pointer)\n\nUnsets the `value` at the specified `pointer` on the `target` and returns the value. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n* The dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nvar prior = ptr.unset(data, '#/legumes/1/instock');\n```\n\nexample force:\n\n```javascript\nvar data = {};\n\nptr.unset(data, '#/peter/piper');\nptr.unset(data, '#/peter/pan');\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .list(target, fragmentId)\n\nLists all of the pointers available on the specified `target`.\n\n> See [a discussion about cycles in the object graph later in this document](#user-content-object-graph-cycles-and-recursion) if you have interest in how such is dealt with.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* an array of `pointer-value` pairs\n\n_example:_\n\n```javascript\nlet list = JsonPointer.list(data);\n```\n\n```json\n[ ...\n  {\n    \"pointer\": \"/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"pointer\": \"/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"pointer\": \"/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"pointer\": \"/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"pointer\": \"/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n_`fragmentId` example:_\n\n```javascript\nlet list = JsonPointer.list(data, true);\n```\n\n```json\n[ ...\n  {\n    \"fragmentId\": \"#/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n#### .flatten(target, fragmentId)\n\nFlattens an object graph (the `target`) into a single-level object of `pointer-value` pairs.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a flattened object of `property-value` pairs as properties.\n\n_example:_\n\n```javascript\nlet obj = JsonPointer.flatten(data, true);\n```\n\n```json\n{ ...\n  \"#/legumes/1/name\": \"lima beans\",\n  \"#/legumes/1/unit\": \"lbs\",\n  \"#/legumes/1/instock\": 21,\n  \"#/legumes/2/name\": \"black eyed peas\",\n  \"#/legumes/2/unit\": \"ea\",\n  \"#/legumes/2/instock\": 9340,\n  \"#/legumes/3/name\": \"plit peas\",\n  \"#/legumes/3/unit\": \"lbs\",\n  \"#/legumes/3/instock\": 8\n}\n```\n\n#### .map(target, fragmentId)\n\nFlattens an object graph (the `target`) into a [Map object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `fragmentId` : _boolean, optional_ &ndash; indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n* a Map object containing key-value pairs where keys are pointers.\n\n_example:_\n\n```javascript\nlet map = JsonPointer.map(data, true);\n\nfor (let it of map) {\n  console.log(JSON.stringify(it, null, '  '));\n}\n```\n\n```json\n...\n[\"#/legumes/0/name\", \"pinto beans\"]\n[\"#/legumes/0/unit\", \"lbs\"]\n[\"#/legumes/0/instock\", 4 ]\n[\"#/legumes/1/name\", \"lima beans\"]\n[\"#/legumes/1/unit\", \"lbs\"]\n[\"#/legumes/1/instock\", 21 ]\n[\"#/legumes/2/name\", \"black eyed peas\"]\n[\"#/legumes/2/unit\", \"ea\"]\n[\"#/legumes/2/instock\", 9340 ]\n[\"#/legumes/3/name\", \"plit peas\"]\n[\"#/legumes/3/unit\", \"lbs\"]\n[\"#/legumes/3/instock\", 8 ]\n```\n\n#### .decode(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = JsonPointer.decode('#/legumes/1/instock');\n```\n\n```json\n[ \"legumes\", \"1\", \"instock\" ]\n```\n\n#### decodePointer(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('/people/wilbur dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodePointer(path)\n\nEncodes the specified `path` as a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_arguments:_\n\n* `path` : _Array, required_ &ndash; an array of path segments\n\n_returns:_\n\n* A JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_example:_\n\n```javascript\nlet path = encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"/people/wilbur dongleworth/age\"\n```\n\n#### decodeUriFragmentIdentifier(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n* `pointer` : _string, required_ &ndash; a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n* An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('#/people/wilbur%20dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodeUriFragmentIdentifier(path)\n\nEncodes the specified `path` as a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_arguments:_\n\n* `path` : _Array, required_ - an array of path segments\n\n_returns:_\n\n* A JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_example:_\n\n```javascript\nlet path = ptr.encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"#/people/wilbur%20dongleworth/age\"\n```\n\n### `JsonPointer` Class\n\nEncapsulates pointer related operations for a specified `pointer`.\n\n_properties:_\n\n* `.path` : _array_ &ndash; contains the pointer's path segements.\n* `.pointer` : _string_ &ndash; the pointer's [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5)\n* `.uriFragmentIdentifier` : _string_ &ndash; the pointer's [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_methods:_\n\n#### .has(target)\n\nDetermins whether the specified `target` has a value at the pointer's path.\n\n#### .get(target)\n\nLooks up the specified `target`'s value at the pointer's path if such exists; otherwise _undefined_.\n\n#### .set(target, value, force)\n\nSets the specified `target`'s value at the pointer's path, if such exists.If `force` is specified (_truthy_), missing path segments are created and the value is always set at the pointer's path.\n\n_arguments:_\n\n* `target` : _object, required_ &ndash; the target object\n* `value` : _any_ &ndash; the value to be set at the specified `pointer`'s path\n* `force` : _boolean, optional_ &ndash; indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_result:_\n\n* The prior value at the pointer's path &mdash; therefore, _undefined_ means the pointer's path was nonexistent.\n\n#### .concat(target)\n\nCreates new pointer appending target to the current pointer's path\n\n_arguments:_\n\n* `target` : _JsonPointer, array or string, required_ &ndash; the path to be appended to the current path\n\n## Performance\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n_Consider this example code that queries the flickr API and prints results to the console:_\n\n```javascript\n'use strict';\n\nlet ptr = require('..'),\n  http = require('http'),\n  util = require('util');\n\n// A flickr feed, tags surf,pipeline\nlet feed = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=surf,pipeline&tagmode=all&format=json&jsoncallback=processResponse';\n\n// Compile/prepare the pointers...\nlet items = ptr.create('#/items');\nlet author = ptr.create('#/author');\nlet media = ptr.create('#/media/m');\n\nfunction processResponse(json) {\n  let data = items.get(json);\n\n  if (data && Array.isArray(data)) {\n    let images = data.reduce((acc, it) => {\n      // Using the prepared pointers to select parts...\n      acc.push({\n        author: author.get(it),\n        media: media.get(it)\n      });\n      return acc;\n    }, []);\n    console.log(util.inspect(images, false, 9));\n  }\n}\n\nhttp.get(feed, function(res) {\n  let data = '';\n\n  res.on('data', function(chunk) {\n    data += chunk;\n  });\n\n  res.on('end', function() {\n    // result is formatted as jsonp... this is for illustration only.\n    data = eval(data); // eslint-disable-line no-eval\n    processResponse(data);\n  });\n}).on('error', function(e) {\n  console.log('Got error: ' + e.message);\n});\n```\n\n> \\[[example/real-world.js](https://github.com/flitbit/json-ptr/blob/master/examples/real-world.js)]\n\n## Tests\n\nTests are written using [mocha](https://mochajs.org/) and [expect.js](https://github.com/Automattic/expect.js).\n\n```bash\nnpm test\n```\n\n... or ...\n\n```bash\nmocha\n```\n\n## Releases\n\n* 2019-09-14 &mdash; __1.2.0__\n  * Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n* 2019-03-10 &mdash; __1.1.2__\n  * Updated packages to remove critical security concern among dev dependencies'\n\n* 2016-07-26 &mdash; __1.0.1__\n  * Fixed a problem with the Babel configuration\n\n* 2016-01-12 &mdash; __1.0.0__\n  * Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n* 2016-01-02 &mdash; __0.3.0__\n  * Retooled for node 4+\n  * Better compiled pointers\n  * Unrolled recursive `.list` function\n  * Added `.map` function\n  * Fully linted\n  * Lots more tests and examples.\n  * Documented many previously undocumented features.\n\n* 2014-10-21 &mdash; __0.2.0__  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"93dc79c7be0acd832ccf7040c9e3f6d20dcd4ce3","scripts":{"ci":"npm run test && npm run test","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests","clean":"rimraf coverage dist dist.browser tmp","pretest":"npm run lint","prebuild":"npm run lint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.1-ts.93dc79c.0_1594387419999_0.9214769985043256","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.1-ts.eec9b2a.0":{"name":"json-ptr","version":"1.2.1-ts.eec9b2a.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.1-ts.eec9b2a.0","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"b9e5e83f9639695b09dec0fa8d60c7243652e03f","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.1-ts.eec9b2a.0.tgz","fileCount":3,"integrity":"sha512-D1dkKFAwr+UT8VXooJ6Eoy5a2LkweE9YZZB5wXHLP7pqFa8XBOApWoCuFOrCUlwmJYuBErmANcrlZjp0x/TFpQ==","signatures":[{"sig":"MEYCIQCq2D2JdCDeULV9yoz5ZDyoMYgdHyn1NrYAsb9xpKH6sAIhAPcJ3WI15EMhOKRkECNSk5w8C2ddNaoOQ/Xo2kk+96Fi","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21112,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCIxFCRA9TVsSAnZWagAARQEP/1xk5nLNqCgT5bnN3qJI\nXaSNp25jojWXHwCkQgtz2v5/RLV++r3ANOblufp2Cn6G9+po8BoE0D2TrGCB\ngEb+eKMmGvBz0fLlXE6h9X2sw3XpsL3eGQ95csGvBDCajSC27PzXg4fIAj5E\nbOUwUHPIP8Buy1sR2UiD0sm3aZ2KqEE2UdlRhi/vmJqxf1eYuzrY8TVnPC9z\n/f/uBZAhi9ED9gQVFOcVQH3yMPUz9E/TA4bCuhcFakTGtwcqKEfV8zDgR7+0\nKZgmdNMJn6Rtxe9G1XPkDCZF2vkQjkaf/MUYUz4COms2Er0Q9GQ/RK9MOEfC\nkwJ/sbBBa0u+UHbcLHABMgRrRkDamalQBZF+Q3CLZIKsoZCwzmXNVFprzluy\nrORcK8PGcJRHgdE5Xe6EYFViI/0Wet2H/NjfYB1DyV0I4dioLFMhhDlpZnmH\naR6zmlTIX7n38F1Oc2UAh8SkNqJPgH5L7ZzCTcOMhvoUqGKQXW4bSuqCohpE\nK5ogv2rB2ymwq0ANqwnD6kqKHUG7VUu08lZCndBdEE0gxufw64L19FqC5pS4\nZSur3T3TdI2is3tez1SHF+qRaBgHtYIYgN26Tde3HN0VlNECe0Mf7/S8sZE8\nRJAADYd9m/O/UGDbK13aGlW856boGdtMcF49IUqysaVDDGffMpQSwLErKPzM\nXaM0\r\n=wEdh\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this module a couple of years ago when I was unable to find what I considered a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\nSince there are a few npm modules for you to choose from, see [the section on performance later in this _readme_](#user-content-performance); you can use your own judgement as to which package you should employ.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Module API\n\n#### Classes\n\n-   [`JsonPointer`](#user-content-jsonpointer-class) : _class_ – a convenience class for working with JSON pointers.\n-   [`JsonReference`](#user-content-jsonreference-class) : _class_ – a convenience class for working with JSON references.\n\n#### Functions\n\n-   [`.create(pointer)`](#user-content-createpointer)\n-   [`.has(target,pointer)`](#user-content-hastargetpointer)\n-   [`.get(target,pointer)`](#user-content-gettargetpointer)\n-   [`.set(target,pointer,value,force)`](#user-content-settarget-pointer-value-force)\n-   [`.unset(target,pointer,value,force)`](#user-content-settarget-pointer-value-force)\n-   [`.flatten(target,fragmentId)`](#user-content-flattentarget-fragmentid)\n-   [`.list(target,fragmentId)`](#user-content-listtarget-fragmentid)\n-   [`.map(target,fragmentId)`](#user-content-maptarget-fragmentid)\n\nAll example code assumes data has this structure:\n\n```javascript\nconst data = {\n  legumes: [{\n    name: 'pinto beans',\n    unit: 'lbs',\n    instock: 4\n  }, {\n    name: 'lima beans',\n    unit: 'lbs',\n    instock: 21\n  }, {\n    name: 'black eyed peas',\n    unit: 'lbs',\n    instock: 13\n  }, {\n    name: 'split peas',\n    unit: 'lbs',\n    instock: 8\n  }]\n}\n```\n\n#### .create(pointer: string | string\\[]): JsonPointer\n\nCreates an instance of the `JsonPointer` class.\n\n_arguments:_\n\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n-   a new [`JsonPointer` instance](#user-content-jsonpointer-class)\n\n_example:_\n\n```ts\nconst pointer = JsonPointer.create('/legumes/0');\n// fragmentId: #/legumes/0\n```\n\n#### .has(target: unknown, pointer: string | string\\[] | JsonPointer): boolean\n\nDetermines whether the specified `target` has a value at the `pointer`'s path.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n-   the dereferenced value or _undefined_ if nonexistent\n\n#### .get(target,pointer)\n\nGets a value from the specified `target` object at the `pointer`'s path\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n-   the dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nlet value = JsonPointer.get(data, '/legumes/1');\n// fragmentId: #/legumes/1\n```\n\n#### .set(target, pointer, value, force)\n\nSets the `value` at the specified `pointer` on the `target`. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n-   `value` : _any_ – the value to be set at the specified `pointer`'s path\n-   `force` : _boolean, optional_ – indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_returns:_\n\n-   The prior value at the pointer's path — therefore, _undefined_ means the pointer's path was nonexistent.\n\n_example:_\n\n```javascript\nlet prior = JsonPointer.set(data, '#/legumes/1/instock', 50);\n```\n\nexample force:\n\n```javascript\nlet data = {};\n\nJsonPointer.set(data, '#/peter/piper', 'man', true);\nJsonPointer.set(data, '#/peter/pan', 'boy', true);\nJsonPointer.set(data, '#/peter/pickle', 'dunno', true);\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"piper\": \"man\",\n    \"pan\": \"boy\",\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .unset(target, pointer)\n\nUnsets the `value` at the specified `pointer` on the `target` and returns the value. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n-   The dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nvar prior = ptr.unset(data, '#/legumes/1/instock');\n```\n\nexample force:\n\n```javascript\nvar data = {};\n\nptr.unset(data, '#/peter/piper');\nptr.unset(data, '#/peter/pan');\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .list(target, fragmentId)\n\nLists all of the pointers available on the specified `target`.\n\n> See [a discussion about cycles in the object graph later in this document](#user-content-object-graph-cycles-and-recursion) if you have interest in how such is dealt with.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `fragmentId` : _boolean, optional_ – indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n-   an array of `pointer-value` pairs\n\n_example:_\n\n```javascript\nlet list = JsonPointer.list(data);\n```\n\n```json\n[ ...\n  {\n    \"pointer\": \"/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"pointer\": \"/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"pointer\": \"/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"pointer\": \"/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"pointer\": \"/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n_`fragmentId` example:_\n\n```javascript\nlet list = JsonPointer.list(data, true);\n```\n\n```json\n[ ...\n  {\n    \"fragmentId\": \"#/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n#### .flatten(target, fragmentId)\n\nFlattens an object graph (the `target`) into a single-level object of `pointer-value` pairs.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `fragmentId` : _boolean, optional_ – indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n-   a flattened object of `property-value` pairs as properties.\n\n_example:_\n\n```javascript\nlet obj = JsonPointer.flatten(data, true);\n```\n\n```json\n{ ...\n  \"#/legumes/1/name\": \"lima beans\",\n  \"#/legumes/1/unit\": \"lbs\",\n  \"#/legumes/1/instock\": 21,\n  \"#/legumes/2/name\": \"black eyed peas\",\n  \"#/legumes/2/unit\": \"ea\",\n  \"#/legumes/2/instock\": 9340,\n  \"#/legumes/3/name\": \"plit peas\",\n  \"#/legumes/3/unit\": \"lbs\",\n  \"#/legumes/3/instock\": 8\n}\n```\n\n#### .map(target, fragmentId)\n\nFlattens an object graph (the `target`) into a [Map object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `fragmentId` : _boolean, optional_ – indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n-   a Map object containing key-value pairs where keys are pointers.\n\n_example:_\n\n```javascript\nlet map = JsonPointer.map(data, true);\n\nfor (let it of map) {\n  console.log(JSON.stringify(it, null, '  '));\n}\n```\n\n```json\n...\n[\"#/legumes/0/name\", \"pinto beans\"]\n[\"#/legumes/0/unit\", \"lbs\"]\n[\"#/legumes/0/instock\", 4 ]\n[\"#/legumes/1/name\", \"lima beans\"]\n[\"#/legumes/1/unit\", \"lbs\"]\n[\"#/legumes/1/instock\", 21 ]\n[\"#/legumes/2/name\", \"black eyed peas\"]\n[\"#/legumes/2/unit\", \"ea\"]\n[\"#/legumes/2/instock\", 9340 ]\n[\"#/legumes/3/name\", \"plit peas\"]\n[\"#/legumes/3/unit\", \"lbs\"]\n[\"#/legumes/3/instock\", 8 ]\n```\n\n#### .decode(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n-   An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = JsonPointer.decode('#/legumes/1/instock');\n```\n\n```json\n[ \"legumes\", \"1\", \"instock\" ]\n```\n\n#### decodePointer(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_returns:_\n\n-   An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('/people/wilbur dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodePointer(path)\n\nEncodes the specified `path` as a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_arguments:_\n\n-   `path` : _Array, required_ – an array of path segments\n\n_returns:_\n\n-   A JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_example:_\n\n```javascript\nlet path = encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"/people/wilbur dongleworth/age\"\n```\n\n#### decodeUriFragmentIdentifier(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n-   `pointer` : _string, required_ – a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n-   An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('#/people/wilbur%20dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodeUriFragmentIdentifier(path)\n\nEncodes the specified `path` as a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_arguments:_\n\n-   `path` : _Array, required_ - an array of path segments\n\n_returns:_\n\n-   A JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_example:_\n\n```javascript\nlet path = ptr.encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"#/people/wilbur%20dongleworth/age\"\n```\n\n### `JsonPointer` Class\n\nEncapsulates pointer related operations for a specified `pointer`.\n\n_properties:_\n\n-   `.path` : _array_ – contains the pointer's path segements.\n-   `.pointer` : _string_ – the pointer's [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5)\n-   `.uriFragmentIdentifier` : _string_ – the pointer's [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_methods:_\n\n#### .has(target)\n\nDetermins whether the specified `target` has a value at the pointer's path.\n\n#### .get(target)\n\nLooks up the specified `target`'s value at the pointer's path if such exists; otherwise _undefined_.\n\n#### .set(target, value, force)\n\nSets the specified `target`'s value at the pointer's path, if such exists.If `force` is specified (_truthy_), missing path segments are created and the value is always set at the pointer's path.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `value` : _any_ – the value to be set at the specified `pointer`'s path\n-   `force` : _boolean, optional_ – indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_result:_\n\n-   The prior value at the pointer's path — therefore, _undefined_ means the pointer's path was nonexistent.\n\n#### .concat(target)\n\nCreates new pointer appending target to the current pointer's path\n\n_arguments:_\n\n-   `target` : _JsonPointer, array or string, required_ – the path to be appended to the current path\n\n## Performance\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n_Consider this example code that queries the flickr API and prints results to the console:_\n\n```javascript\n'use strict';\n\nlet ptr = require('..'),\n  http = require('http'),\n  util = require('util');\n\n// A flickr feed, tags surf,pipeline\nlet feed = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=surf,pipeline&tagmode=all&format=json&jsoncallback=processResponse';\n\n// Compile/prepare the pointers...\nlet items = ptr.create('#/items');\nlet author = ptr.create('#/author');\nlet media = ptr.create('#/media/m');\n\nfunction processResponse(json) {\n  let data = items.get(json);\n\n  if (data && Array.isArray(data)) {\n    let images = data.reduce((acc, it) => {\n      // Using the prepared pointers to select parts...\n      acc.push({\n        author: author.get(it),\n        media: media.get(it)\n      });\n      return acc;\n    }, []);\n    console.log(util.inspect(images, false, 9));\n  }\n}\n\nhttp.get(feed, function(res) {\n  let data = '';\n\n  res.on('data', function(chunk) {\n    data += chunk;\n  });\n\n  res.on('end', function() {\n    // result is formatted as jsonp... this is for illustration only.\n    data = eval(data); // eslint-disable-line no-eval\n    processResponse(data);\n  });\n}).on('error', function(e) {\n  console.log('Got error: ' + e.message);\n});\n```\n\n> \\[[example/real-world.js](https://github.com/flitbit/json-ptr/blob/master/examples/real-world.js)]\n\n## Tests\n\nTests are written using [mocha](https://mochajs.org/) and [expect.js](https://github.com/Automattic/expect.js).\n\n```bash\nnpm test\n```\n\n... or ...\n\n```bash\nmocha\n```\n\n## Releases\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"eec9b2a0a9c4c59ed9675d80e390c03e45a6312a","scripts":{"ci":"npm run test && npm run test","docs":"typedoc","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","clean":"rimraf coverage dist dist.browser tmp docs","pretest":"npm run lint","prebuild":"npm run lint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.1-ts.eec9b2a.0_1594395716999_0.6618792160446856","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.1-ts.54cfffa":{"name":"json-ptr","version":"1.2.1-ts.54cfffa","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.1-ts.54cfffa","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"123e14396656a413da08982912a03b323b70640f","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.1-ts.54cfffa.tgz","fileCount":3,"integrity":"sha512-tgO+dKSeKa1VkMlVpnkLhqMMxcG1/XCSXsSAgfztc/Pb5NLB3o4ZNOM9CMjMkNUATCMRpftHPNgh64lf6B2Dzg==","signatures":[{"sig":"MEUCIQCtIIJ8IWXv4AxxDrkvGFjg8MJ2qKTwjz0iCBqHVsSq8QIgFQv1XH7CUp001qcVk0xxISHRvxKU943VAxP4AI1yM2g=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":21110,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCJFGCRA9TVsSAnZWagAATIoP/3c+g85xOTQQVYLBUMlH\njKIe/Eet+P8voimeGNnbWtjN4SENIrtpaxNTW7jT5T90+rwZEHFp6lSJGaW/\nzrE2qxNOugR1vxMen5tUKiS3KJ/ml7SPys3O40rjMSX3XKloTWzdUotD6Kzw\nptqz0foqmJD1XVsUMBOrlmJFDXJl5oI95Aa/Phy/dUZ6Zew8eYPe4AckLoh5\nd1hepgmSTRu41VPirLaAu3akINboLEHHeLCAGydtJhcS4SDwPYrCXFD3zpwm\nIKEeRkSEVRMmUZ4Ga3zgqgK3VQ9U30HF7PEvs388rRnqLTRVWjBJK3bX6wII\naZWBTxZhCl1pHKSuf78JQs3Z97mqSEtSRMIWDAXzsnOVO9LF0E/LTFWSLqMG\nQeyrlQ1FxMDP/YttKHf8DEKpYnTCmQPeFcw2q1qOwHPHMNXKRJsrxoPmPVZK\nEdUStjvYZseSoACZ0iILSmo1Kp0F2cm7zwDx2snKUO1NWVOzlFWT8cb44Xt8\nOMaA6ua3dSA46KSBZrfQOARWsvOUyY75E+LzNfMO6HFtnzsrn6RXnJZyE6o9\nutuKWoqv5kqAGac3+WjqiPylZQBdfzle4KdTf/0+AFw+n+/F1MyeDvLWi581\n029+zxz5pFpicVthsEKQr5SaMQHyVn2ApnzBrRIv1FUNgddY85znExjZyHBR\nTWYb\r\n=Z+2C\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this module a couple of years ago when I was unable to find what I considered a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\nSince there are a few npm modules for you to choose from, see [the section on performance later in this _readme_](#user-content-performance); you can use your own judgement as to which package you should employ.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Module API\n\n#### Classes\n\n-   [`JsonPointer`](#user-content-jsonpointer-class) : _class_ – a convenience class for working with JSON pointers.\n-   [`JsonReference`](#user-content-jsonreference-class) : _class_ – a convenience class for working with JSON references.\n\n#### Functions\n\n-   [`.create(pointer)`](#user-content-createpointer)\n-   [`.has(target,pointer)`](#user-content-hastargetpointer)\n-   [`.get(target,pointer)`](#user-content-gettargetpointer)\n-   [`.set(target,pointer,value,force)`](#user-content-settarget-pointer-value-force)\n-   [`.unset(target,pointer,value,force)`](#user-content-settarget-pointer-value-force)\n-   [`.flatten(target,fragmentId)`](#user-content-flattentarget-fragmentid)\n-   [`.list(target,fragmentId)`](#user-content-listtarget-fragmentid)\n-   [`.map(target,fragmentId)`](#user-content-maptarget-fragmentid)\n\nAll example code assumes data has this structure:\n\n```javascript\nconst data = {\n  legumes: [{\n    name: 'pinto beans',\n    unit: 'lbs',\n    instock: 4\n  }, {\n    name: 'lima beans',\n    unit: 'lbs',\n    instock: 21\n  }, {\n    name: 'black eyed peas',\n    unit: 'lbs',\n    instock: 13\n  }, {\n    name: 'split peas',\n    unit: 'lbs',\n    instock: 8\n  }]\n}\n```\n\n#### .create(pointer: string | string\\[]): JsonPointer\n\nCreates an instance of the `JsonPointer` class.\n\n_arguments:_\n\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n-   a new [`JsonPointer` instance](#user-content-jsonpointer-class)\n\n_example:_\n\n```ts\nconst pointer = JsonPointer.create('/legumes/0');\n// fragmentId: #/legumes/0\n```\n\n#### .has(target: unknown, pointer: string | string\\[] | JsonPointer): boolean\n\nDetermines whether the specified `target` has a value at the `pointer`'s path.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n-   the dereferenced value or _undefined_ if nonexistent\n\n#### .get(target,pointer)\n\nGets a value from the specified `target` object at the `pointer`'s path\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n-   the dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nlet value = JsonPointer.get(data, '/legumes/1');\n// fragmentId: #/legumes/1\n```\n\n#### .set(target, pointer, value, force)\n\nSets the `value` at the specified `pointer` on the `target`. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n-   `value` : _any_ – the value to be set at the specified `pointer`'s path\n-   `force` : _boolean, optional_ – indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_returns:_\n\n-   The prior value at the pointer's path — therefore, _undefined_ means the pointer's path was nonexistent.\n\n_example:_\n\n```javascript\nlet prior = JsonPointer.set(data, '#/legumes/1/instock', 50);\n```\n\nexample force:\n\n```javascript\nlet data = {};\n\nJsonPointer.set(data, '#/peter/piper', 'man', true);\nJsonPointer.set(data, '#/peter/pan', 'boy', true);\nJsonPointer.set(data, '#/peter/pickle', 'dunno', true);\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"piper\": \"man\",\n    \"pan\": \"boy\",\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .unset(target, pointer)\n\nUnsets the `value` at the specified `pointer` on the `target` and returns the value. The default behavior is to do nothing if `pointer` is nonexistent.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_returns:_\n\n-   The dereferenced value or _undefined_ if nonexistent\n\n_example:_\n\n```javascript\nvar prior = ptr.unset(data, '#/legumes/1/instock');\n```\n\nexample force:\n\n```javascript\nvar data = {};\n\nptr.unset(data, '#/peter/piper');\nptr.unset(data, '#/peter/pan');\n\nconsole.log(JSON.stringify(data, null, '  '));\n```\n\n```json\n{\n  \"peter\": {\n    \"pickle\": \"dunno\"\n  }\n}\n```\n\n#### .list(target, fragmentId)\n\nLists all of the pointers available on the specified `target`.\n\n> See [a discussion about cycles in the object graph later in this document](#user-content-object-graph-cycles-and-recursion) if you have interest in how such is dealt with.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `fragmentId` : _boolean, optional_ – indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n-   an array of `pointer-value` pairs\n\n_example:_\n\n```javascript\nlet list = JsonPointer.list(data);\n```\n\n```json\n[ ...\n  {\n    \"pointer\": \"/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"pointer\": \"/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"pointer\": \"/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"pointer\": \"/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"pointer\": \"/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n_`fragmentId` example:_\n\n```javascript\nlet list = JsonPointer.list(data, true);\n```\n\n```json\n[ ...\n  {\n    \"fragmentId\": \"#/legumes/2/unit\",\n    \"value\": \"ea\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/2/instock\",\n    \"value\": 9340\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/name\",\n    \"value\": \"plit peas\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/unit\",\n    \"value\": \"lbs\"\n  },\n  {\n    \"fragmentId\": \"#/legumes/3/instock\",\n    \"value\": 8\n  }\n]\n```\n\n#### .flatten(target, fragmentId)\n\nFlattens an object graph (the `target`) into a single-level object of `pointer-value` pairs.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `fragmentId` : _boolean, optional_ – indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n-   a flattened object of `property-value` pairs as properties.\n\n_example:_\n\n```javascript\nlet obj = JsonPointer.flatten(data, true);\n```\n\n```json\n{ ...\n  \"#/legumes/1/name\": \"lima beans\",\n  \"#/legumes/1/unit\": \"lbs\",\n  \"#/legumes/1/instock\": 21,\n  \"#/legumes/2/name\": \"black eyed peas\",\n  \"#/legumes/2/unit\": \"ea\",\n  \"#/legumes/2/instock\": 9340,\n  \"#/legumes/3/name\": \"plit peas\",\n  \"#/legumes/3/unit\": \"lbs\",\n  \"#/legumes/3/instock\": 8\n}\n```\n\n#### .map(target, fragmentId)\n\nFlattens an object graph (the `target`) into a [Map object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map).\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `fragmentId` : _boolean, optional_ – indicates whether fragment identifiers should be listed instead of pointers\n\n_returns:_\n\n-   a Map object containing key-value pairs where keys are pointers.\n\n_example:_\n\n```javascript\nlet map = JsonPointer.map(data, true);\n\nfor (let it of map) {\n  console.log(JSON.stringify(it, null, '  '));\n}\n```\n\n```json\n...\n[\"#/legumes/0/name\", \"pinto beans\"]\n[\"#/legumes/0/unit\", \"lbs\"]\n[\"#/legumes/0/instock\", 4 ]\n[\"#/legumes/1/name\", \"lima beans\"]\n[\"#/legumes/1/unit\", \"lbs\"]\n[\"#/legumes/1/instock\", 21 ]\n[\"#/legumes/2/name\", \"black eyed peas\"]\n[\"#/legumes/2/unit\", \"ea\"]\n[\"#/legumes/2/instock\", 9340 ]\n[\"#/legumes/3/name\", \"plit peas\"]\n[\"#/legumes/3/unit\", \"lbs\"]\n[\"#/legumes/3/instock\", 8 ]\n```\n\n#### .decode(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5) or [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n-   An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = JsonPointer.decode('#/legumes/1/instock');\n```\n\n```json\n[ \"legumes\", \"1\", \"instock\" ]\n```\n\n#### decodePointer(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n-   `pointer` : _string, required_ – a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_returns:_\n\n-   An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('/people/wilbur dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodePointer(path)\n\nEncodes the specified `path` as a JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_arguments:_\n\n-   `path` : _Array, required_ – an array of path segments\n\n_returns:_\n\n-   A JSON pointer in [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5).\n\n_example:_\n\n```javascript\nlet path = encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"/people/wilbur dongleworth/age\"\n```\n\n#### decodeUriFragmentIdentifier(pointer)\n\nDecodes the specified `pointer`.\n\n_arguments:_\n\n-   `pointer` : _string, required_ – a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_returns:_\n\n-   An array of path segments used as indexers to descend from a root/`target` object to a referenced value.\n\n_example:_\n\n```javascript\nlet path = decodePointer('#/people/wilbur%20dongleworth/age');\n```\n\n```json\n[ \"people\", \"wilbur dongleworth\", \"age\" ]\n```\n\n#### encodeUriFragmentIdentifier(path)\n\nEncodes the specified `path` as a JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_arguments:_\n\n-   `path` : _Array, required_ - an array of path segments\n\n_returns:_\n\n-   A JSON pointer in [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6).\n\n_example:_\n\n```javascript\nlet path = ptr.encodePointer(['people', 'wilbur dongleworth', 'age']);\n```\n\n```json\n\"#/people/wilbur%20dongleworth/age\"\n```\n\n### `JsonPointer` Class\n\nEncapsulates pointer related operations for a specified `pointer`.\n\n_properties:_\n\n-   `.path` : _array_ – contains the pointer's path segements.\n-   `.pointer` : _string_ – the pointer's [JSON string representation](https://tools.ietf.org/html/rfc6901#section-5)\n-   `.uriFragmentIdentifier` : _string_ – the pointer's [URI fragment identifier representation](https://tools.ietf.org/html/rfc6901#section-6)\n\n_methods:_\n\n#### .has(target)\n\nDetermins whether the specified `target` has a value at the pointer's path.\n\n#### .get(target)\n\nLooks up the specified `target`'s value at the pointer's path if such exists; otherwise _undefined_.\n\n#### .set(target, value, force)\n\nSets the specified `target`'s value at the pointer's path, if such exists.If `force` is specified (_truthy_), missing path segments are created and the value is always set at the pointer's path.\n\n_arguments:_\n\n-   `target` : _object, required_ – the target object\n-   `value` : _any_ – the value to be set at the specified `pointer`'s path\n-   `force` : _boolean, optional_ – indicates [whether nonexistent paths are created during the call](https://tools.ietf.org/html/rfc6901#section-7)\n\n_result:_\n\n-   The prior value at the pointer's path — therefore, _undefined_ means the pointer's path was nonexistent.\n\n#### .concat(target)\n\nCreates new pointer appending target to the current pointer's path\n\n_arguments:_\n\n-   `target` : _JsonPointer, array or string, required_ – the path to be appended to the current path\n\n## Performance\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n_Consider this example code that queries the flickr API and prints results to the console:_\n\n```javascript\n'use strict';\n\nlet ptr = require('..'),\n  http = require('http'),\n  util = require('util');\n\n// A flickr feed, tags surf,pipeline\nlet feed = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=surf,pipeline&tagmode=all&format=json&jsoncallback=processResponse';\n\n// Compile/prepare the pointers...\nlet items = ptr.create('#/items');\nlet author = ptr.create('#/author');\nlet media = ptr.create('#/media/m');\n\nfunction processResponse(json) {\n  let data = items.get(json);\n\n  if (data && Array.isArray(data)) {\n    let images = data.reduce((acc, it) => {\n      // Using the prepared pointers to select parts...\n      acc.push({\n        author: author.get(it),\n        media: media.get(it)\n      });\n      return acc;\n    }, []);\n    console.log(util.inspect(images, false, 9));\n  }\n}\n\nhttp.get(feed, function(res) {\n  let data = '';\n\n  res.on('data', function(chunk) {\n    data += chunk;\n  });\n\n  res.on('end', function() {\n    // result is formatted as jsonp... this is for illustration only.\n    data = eval(data); // eslint-disable-line no-eval\n    processResponse(data);\n  });\n}).on('error', function(e) {\n  console.log('Got error: ' + e.message);\n});\n```\n\n> \\[[example/real-world.js](https://github.com/flitbit/json-ptr/blob/master/examples/real-world.js)]\n\n## Tests\n\nTests are written using [mocha](https://mochajs.org/) and [expect.js](https://github.com/Automattic/expect.js).\n\n```bash\nnpm test\n```\n\n... or ...\n\n```bash\nmocha\n```\n\n## Releases\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"54cfffae9df1e8414966c34f15ddb9eb234e8adc","scripts":{"ci":"npm run test && npm run test","docs":"typedoc","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","clean":"rimraf coverage dist dist.browser tmp docs","pretest":"npm run lint","prebuild":"npm run lint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.1-ts.54cfffa_1594396998158_0.4776374500023004","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.1-ts.d9366c0":{"name":"json-ptr","version":"1.2.1-ts.d9366c0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.1-ts.d9366c0","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"530110072b65e6dd931c87eb53c33a003d86188c","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.1-ts.d9366c0.tgz","fileCount":17,"integrity":"sha512-zmAej55CVoR8pPvqUMogYEic2srrT59MQQjciq3bJ93w1jOh3ZX6cmExeuuvo10pdCIR+lrvvQ2PubvnjWLaYA==","signatures":[{"sig":"MEUCIBS9GtycT/ZDxFwqL1Lg4XMfSkksl+q46PbHf3XV+2mjAiEAqiyxkkM0+dmkUyLqqYedKbWrcEYf1xyM5HmcTwMPsAo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193447,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCMDBCRA9TVsSAnZWagAAQNwP/jvdHAwum4FuLyZtXtWF\n7Q9gC37rpbcEXci4h3yhXWKPT9/raTOhVCp9QihtXiRS5UOwa8y7UFhm6glv\n6wbSSsgmrPHSoyvFIYvsq4DX7vCTMgwVLRMOZOdsDIBkR+dB2/isneWyZzJJ\nN9meLQAytesEmiqEPqU7yJ/7uPMwXd2LxGWtpV8EIdBTtTdCwCZrr4CH+0xg\nZlzt/4+Q7D0FPMI/NpBdSOI1+bCDXFA0AXldHXQCKCvfFHU+0U+8NPrk/aNI\nNVR4Ib7ESZyFO4Qn8rDSxQQN7VrZ22R++IFYePDvvdoYWqH0YUUVAEsJLzD9\nw6YarSQj35HyE5EZTXhx+CdxENYYSeMoFjVRttNJJK101mNvNvA/BplEh14F\nKF+CsAE/Z+adIZbroaZoQAquun3p2Lc+Ny1ieesndTQlUoDOycQYxw44KnMR\nnDFN/mEvWkeq9Y5VScR2WFp1xOplOet864XLsZGC6RQ25ggnY6TnCWnAtadB\n8gfyIJ0EbdOnSeUVJyM385EWPkvvul4+7rH8/DRFBU7BrO8fPc2+5464O1DN\njJ9ZWeLh29D3xgVineYT6tomAOnyapa7INSfTJcTkcZ5ya/1LmTQzRsLhy8+\nZwmJIY1iHyYwn0FlBmineEX/S1vigoyIxk7S4fBi5znfHlT92i01HeKEklq5\n2LQ6\r\n=YgKE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\nSince there are a few npm modules for you to choose from, see [the section on performance later in this _readme_](#user-content-performance); you can use your own judgement as to which package you should employ.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## API Documentation\n\nThe API documentation is generated from code comments by typedoc and [hosted here](<>).\n\nWe welcome new issues if you have questions or need additional documentation.\n\n## Performance\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n_Consider this example code that queries the flickr API and prints results to the console:_\n\n```javascript\n'use strict';\n\nlet ptr = require('..'),\n  http = require('http'),\n  util = require('util');\n\n// A flickr feed, tags surf,pipeline\nlet feed = 'http://api.flickr.com/services/feeds/photos_public.gne?tags=surf,pipeline&tagmode=all&format=json&jsoncallback=processResponse';\n\n// Compile/prepare the pointers...\nlet items = ptr.create('#/items');\nlet author = ptr.create('#/author');\nlet media = ptr.create('#/media/m');\n\nfunction processResponse(json) {\n  let data = items.get(json);\n\n  if (data && Array.isArray(data)) {\n    let images = data.reduce((acc, it) => {\n      // Using the prepared pointers to select parts...\n      acc.push({\n        author: author.get(it),\n        media: media.get(it)\n      });\n      return acc;\n    }, []);\n    console.log(util.inspect(images, false, 9));\n  }\n}\n\nhttp.get(feed, function(res) {\n  let data = '';\n\n  res.on('data', function(chunk) {\n    data += chunk;\n  });\n\n  res.on('end', function() {\n    // result is formatted as jsonp... this is for illustration only.\n    data = eval(data); // eslint-disable-line no-eval\n    processResponse(data);\n  });\n}).on('error', function(e) {\n  console.log('Got error: ' + e.message);\n});\n```\n\n> \\[[example/real-world.js](https://github.com/flitbit/json-ptr/blob/master/examples/real-world.js)]\n\n## Tests\n\nTests are written using [mocha](https://mochajs.org/) and [expect.js](https://github.com/Automattic/expect.js).\n\n```bash\nnpm test\n```\n\n... or ...\n\n```bash\nmocha\n```\n\n## Releases\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"d9366c04e63084bf8e4a47af1f422809efe2bb1d","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.1-ts.d9366c0_1594409152961_0.9777389039648599","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.1-ts.cf62f17":{"name":"json-ptr","version":"1.2.1-ts.cf62f17","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.1-ts.cf62f17","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"f1b4764c81f7be5f5f3077848d8b21b6630d394d","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.1-ts.cf62f17.tgz","fileCount":17,"integrity":"sha512-X+tJP0Rx1PtfksV6ydlc0zR+DTP/5o3ctcy2k/i6LgApFFJnp4R4blH6SIlWDXEcTGXmVd/VV++lMIO3V+IcyQ==","signatures":[{"sig":"MEUCIQDPyI5vRf9A59HavKnvIBIX3MBAnfUO1pTZIvDaVlxzWgIge1uLz6esSOSwynSKFUcyYM+HEDqqi/Ifo3KmgpN8bJ4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":192945,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCMfyCRA9TVsSAnZWagAAG6IQAKOn6zl+BvndhMaPAlXn\n3UTJS77ABZiIb6YXUUOF/liS1bQ6DsbTUHM0xnb1tcxQUzZe8xc+5mBuxCze\nouLddZiAnFPp/EO3/ALTuM6s+fEYa4szKpn2fRnbomhhz/9xieufoYIW0n6D\nEdGykpTKbeTdSQt9OPCZZ3KJVzhoJ+XXOdVhtjF40lpjVKTmMzztaXbVTvM9\nVTuigt53l812+qUjO4OR1p3+/qGXer8J2R6pstXG3/GIVkG6K/UrU6EUAcoU\nbm4ajh89VBRjU51K3EQqYJ+5fQ6igMTLUPGhFu6G44JvtFwBlphvwLeX1+PF\noCqYYM+mtRMJewE/AevgdEhqktabTA9m7UWe5Yl7IdS/NtDt0oQL6PMcMWK3\nw1gGMkO0HHaphWcc5uRJYYap/NLFZlcMZK81gKxCfFrxVyTcXi//ywgpMKw4\nyEK1nIw4JaJ+jhqIKBuPy/pWoTlawRuwKCPOtTjpJgz8sc70gEvQpSNRPXVX\nR85ivyb+XuJSWuMqf5IjgevbjmOffHoh7gUR/k15raWbqVfy0FJ29etUV8ct\n8OW22E0Ya+S9bagwdzwYKsAP/XhkDxLV4W3Yv7FhE/WCBdDSls6TtZzrkTAb\ns6SkSCc5SudDWBXNA7eMGPosTE7dLpAP7VBx7NBf92UUz0z/T8sRGkBnHi8Q\neIr8\r\n=C9KQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## API Documentation\n\nThe API documentation is generated from code comments by typedoc and [hosted here](<>).\n\nWe welcome new issues if you have questions or need additional documentation.\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"cf62f172e5d0b1069981055ffce8dc7b14c68d22","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.1-ts.cf62f17_1594410993853_0.6399416751456781","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.2.1-master.9e1cb86":{"name":"json-ptr","version":"1.2.1-master.9e1cb86","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.2.1-master.9e1cb86","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"1d9fea977740be06523eacf07c5ee2c391b7b1e1","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.2.1-master.9e1cb86.tgz","fileCount":17,"integrity":"sha512-77TEJEd9piFdD1P8+E4B3K2mzlf58Y8ldsILIkJojSIEfvVgNVOeF/ZVXyCYVphojNUFBjMXdWZ0EMhesxlyHg==","signatures":[{"sig":"MEUCIBukffnozJdg7fF7BHOORC2h4dDNL65/GkpuBsaBR3yqAiEA++5byMA7x7T6T6R7OjBsqCGK3Pb+kuGUX4NpFaGi6NE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":192949,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCMhMCRA9TVsSAnZWagAAdpkP/1ZCmPxZjN84Lf+PHOjF\n7BWRAuzBhPxM69wLj0Y6U9GQV36oLixt4neX3lpC0jUsdFPENyVcKdoZM1Jq\n4cB0ibPiFARf5PuOEJTfDDux4z0chJuwoUDcTtD+f8Ap83L6g+asOpPsTwO9\nIC8t+1PFvQPAmPxDdMx+rhHrqNDm8r88A2WBz5QAdloZwMNuueSBgXCShWYk\nff7QY0yiTkucQG49ISW3j9N5A1VutNqG83FwGTUjNAZPnHsxiz+Y1heUUW5d\nXBTwVSHsNebO3N2N5kPNRdtfKXm1O4BUmjLOB38Vn3prP/Nm++PN8nsKTziB\nYblLlDfMEiQP68igRH+Bqyi7K1ftWqfhHVGGM22yVG4RnJiTVhP+sXaj9S85\nq9deM4tC33wsOLg6NCxYkaE8piqBkjCr/MNJt2zjbiwOPqwF1yCA/UMpPoHf\nFPGLZnzNcRHjqoLJ9NU+4LZyj+F2T7PtsE75wQk/wIbAUhUnper8uXt+lWR2\ndldzxCtnD/Hll6vxQ08FdHASUfwddWfTINp1IvSbCxMNXLhHs5j/s5qob6xC\nyj4HjPu615EyLXiLPwL1m/b94pd5QIwLbUu/szuLu5r9LgDDAPgf+sSS4awq\n+MGdJSS/uS+ZxVMYGhLP5IGnPlzybJMrXGcmdSBH/1Dqn7R8A/Y7KsqGbiug\nUfop\r\n=yuWn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## API Documentation\n\nThe API documentation is generated from code comments by typedoc and [hosted here](<>).\n\nWe welcome new issues if you have questions or need additional documentation.\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"9e1cb8667c20337ccd33efae63ebeedcd4097d96","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.2.1-master.9e1cb86_1594411084418_0.599989971459354","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.0":{"name":"json-ptr","version":"1.3.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.0","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"1cca1b4adb1f2b3b4747a61d487e5d8d9beec962","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.0.tgz","fileCount":17,"integrity":"sha512-EaNZN2Pd8c8snLk8vETHW/xbl2Q7vHYFC5V/9z9lOiC8JG3+qsletPLwg/cJ2QxGNQL6LZBaJ3Q3iamnMJskag==","signatures":[{"sig":"MEUCIQC1vNwEwsdZstVijqbjB0/ZADT0wWESlRfAGbPcRkjZ3QIgHS1cP2ipcYooUwO4K3Xr/D1HWs0Pnif4wAWHPp9tsqA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":192986,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCMs7CRA9TVsSAnZWagAAnKoP/iMzscii8Kvc8uiq02+c\nIZ6B2Lbrk4DZGa+lUI4+TyhUYCF0F5AD9vE4zjrEExtRgej8EZBw8EcXxIck\nbJbCnshrZp0LxpxrtParYGZgaskuoPCXFHZQ2OgRqe/Xxv0dxQSmPRNT/CUM\nBEINAOCTQxqQjQtuDKJRshZeydfXbYaTrmxaXqyPPgpE35DaYGZNGb2JsdIb\npbiI1s3r7lZoawsoYqv/BRUK25SmzI9zvtMQS07R+nlRAFfZ2Pyafp1xlrpj\noAcAEIq8v3oNeXPhBcT/jh5c0bpKmgItHlFMAxwomxsQUugfIdCbJ8pN3KZF\nieKq94hGJIEitILUaq/o0sNvZ7Rsks/v3yb0ZKojEU4L8ukBCfbiKXZ//RDE\nlqHKnbkGHLgU7ynz/cA+jYLtth4aUZUcrylr1pVft6qMba5bRm3FWKtUTiOW\nNI3i1Cq/BGNqWhGcCgNceYQLc5d+kjqyapwt90j1eMthui5TwB3TaWcQcTc9\nrAW94LGwiombqf92SNFkYDvz58fjOu52AtYpdyuAAZWjjpGvtd9V56iB/z81\n4UBpTqJAgdukIQyV8nTG5f2eoQRA+JGI3NtrEVgLtUPlEXSsErA+dQcfwWmW\n+SDkmfH8fQ+wBcMki+Hc2SDh7KIpXYglikp05DYfvaXlmJl2uVaLkNJ+KNa3\nIwWg\r\n=LJ8f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"89833786a59371f05710a0a7ae636880147d54da","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.0_1594411834771_0.6817403610759367","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.1-master.8983378":{"name":"json-ptr","version":"1.3.1-master.8983378","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.1-master.8983378","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"7982c58253974ede666e14463597f824cdbd37dd","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.1-master.8983378.tgz","fileCount":17,"integrity":"sha512-9yeDJbfqiuCH56mI1z5yY2FAhqMChabkRve+WuxA5HofRNGTt/rSzioJ+Myv3iq2t7L3NEbKc3vy+btEAPefrw==","signatures":[{"sig":"MEQCIHtU69+PDXVqhP0e25b2WVsjSeveRynPD/Mp0q9WaQc5AiBqgzHZeTADO3Xj1DbeXbFjhIodUBtkNegxjsOFvZ4EYA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193001,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCMtLCRA9TVsSAnZWagAA+cIQAKM6yJ8bEgrcIC2BxdJs\nbE4jZx4qk9R3pxFyf06UZLTU+bdaP58cSb/oxAf1y9xQtMFMBQ3XDyBm4SlT\nJuCB9LF+X3HvAtW6v/FyqBQKlZzekDDhLB6Mhxc5+vHQscCPOveyez8LsJsQ\nW5Xw4JiGkNsrp00xAryiLYslodar6peDNud0iV56XovydxCSXHH4aXN2RSHJ\n2uQX1VapWnXoFI7XziER65vvmspJCfsB1FQcywmwlasfOK3y+rBboOPqxQ/T\np/D7xXgNopj9t7YmIl9IZ+E+h3lRFAj58C2Q/GFDImGzGOK6wraHhkbUsYWd\nXxLBKw6JhqDRy1MFiJgnMcH9dRRRg0mOLkqZkiJxBBAjpnGjG1pPruhJoi9P\nGSuydU9rkEC36N46YQuBnvIsVHsg4TeIPjr8eRtkO1P1cWL7kWV5i8eKoc55\n36fya4lLlJeGQ0c6fqKpmX0nBBLuF+vrPUuCXdU4wpqnLFmaix8vkYEhOrl7\nxVyf+01rVtrqTF2wJzbA8xwvKzynER0NBbqM76CJkm38et3PC9w3lj2scNoz\n+lcShfzwD28H+AluBG7569gAhBvNRUi35dhb1gNJs+BIDuRV4GvZ5EsKv4Jf\nAyIXewut/XamZcY/PzELMRGNNIMc0w6CPGJySBQSfRiQzrjjMRBEQ0mOJT4F\nS36x\r\n=uG0m\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## API Documentation\n\nThe API documentation is generated from code comments by typedoc and [hosted on github](http://flitbit.github.io/json-ptr/). Read the docs.\n\nWe welcome new issues if you have questions or need additional documentation.\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"89833786a59371f05710a0a7ae636880147d54da","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.1-master.8983378_1594411851138_0.023116292071569955","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.1-master.f714cdc":{"name":"json-ptr","version":"1.3.1-master.f714cdc","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.1-master.f714cdc","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"4678c0273d36b208f3a076581706bad8741ac4a3","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.1-master.f714cdc.tgz","fileCount":17,"integrity":"sha512-ZKNyqBOn6d2K7GKz28ZktlT+O7/jMTTytwoOog8aL3fhaC9dwdWJHcG/qSw1hVIiFZDpeFhf4/FXz9p9ojS+9A==","signatures":[{"sig":"MEUCIQDZhJYRn7y90OQAxfYbT9dSOLlpTiiYCKKFFu4hV7xTvQIgRbpUzDkEQLdT+yWfFxGYhswUYUiSH2GJ0jcJgkZIlVM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193001,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCM42CRA9TVsSAnZWagAAGygP/32p6/4bOlIT9CSR78Im\nIzOFIWWE0gY03VO/UPr7Vnk039T7W4ibwgVh9PFr0aQ4XCCwa+j+zL/Gpjgq\nkScIRtG1iT4NLBY9RZFTm89WXArlTlA8WwxDfsoJhcroHzwTP+O/BNYN++Uv\nvdvRT0r7RG11PYhj0evxJ0T9p2ImwC1SvG9dzomAtchDTd7XKXOV0ilpZdtW\nCFE8lBxVygVXhtztU2XPFmGSW8jJGnyGJvNyaUd/z99qCY9pVWxZcB3MtAUD\nUXD3gvncj3KXcF00BcGKpypU7o2h7ZghzlYrYh9QAhvIq38shxZboUrbiRJB\nTOODO7FwZI8lkH4CYn3EBmH48j/6ZTiIjz/yKp5NKO+UdaTcqVI1fHnh5rQK\nwtDfgcPGiWxVcswUxNL+f637xZn8cW4183j9HGaFFW3atyP+GdwCNI7G4zSb\nAawyEeeRzNh5sFeO2LumrnvY2/Pc0C1kBWlGsMu0UlqCzs70IRAWnUtLaTIa\n0KXs8MQRdGMnWU/W3CXHxMLRx/jLGDRLT+5VDAKzrNhbQk+Y77cClTgMjWKg\nx1t5yd0EeThalxKm9Sa2tUHkPAq8ABc8Wqg5YEjWUDbH3zhUUImv3/rPSCAT\nMjp/tXEZZ6u2ffYt3ssYhooxaI97QYq8XRDRSOQeuX1YTEsfaZHv1orjCcHO\nwFs2\r\n=naXZ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## API Documentation\n\nThe API documentation is generated from code comments by typedoc and [hosted on github](http://flitbit.github.io/json-ptr/). Read the docs.\n\nWe welcome new issues if you have questions or need additional documentation.\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"f714cdc5db02afa328026e9e2ede1438adf1779f","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.1-master.f714cdc_1594412597898_0.8696398239827492","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.1-master.ef9842c":{"name":"json-ptr","version":"1.3.1-master.ef9842c","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.1-master.ef9842c","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"5cf2d92788b64e7049c791359d97460531acb1b6","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.1-master.ef9842c.tgz","fileCount":17,"integrity":"sha512-nObpBTpd9HXHmfjlXVaqIbW6/4UD5/XJYFWL8O1HUODW2KdhFCWUG28ZEfxVNe6crz5/a9wMGzF8MdpLa2dZ/A==","signatures":[{"sig":"MEQCIHJUhBc0MDc251yKbUrnTOAQIQIhHEFueZ/g3bYhkU0RAiBQ0cEbb93TGnMdgRuZVtJ01wo4OtVAPeVyy58wZ8+J/g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193001,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCNDRCRA9TVsSAnZWagAABE4P/1zTbACYjMjmlmc5p75Z\nOLelqVQ6jWg2MsWRLl4cCRrwNn+btsEmbi0zSJ4HjVNxowRBYft8sRyfhmsa\nqgddgdi2X3R3sFHdfQIb0q8VyEe2237qUEVM8gWpARoHa0FRtiKvOizMnXM+\noeOLfLDZMw8y9jv5x+2myopm21BhG9vh3HhJqe5ukWMivEsvJpZNfK/hc45g\nmD4f5Klkp8WN94zOF/Wkj7Y6JD/gWZpQNjzL63OcVZ2+bbjmhpHs+JZLT+ug\nuSfCCk+tmc2FYKxXJx+YE7SNPTV6HrO0D/3JAQWiJ9sIjDdtSOPqCTN3/XP1\nNWJW6Jt1n7Ap9htjORVXQchrzFkhPIQYIjTLNrP9D6ukIchMudqTPTpgCh+t\n4BsIS2m6qUGeYM/6VKx8D5NZes0zaqdvyuFEMdcAWbvuH0Vqx6Py2sFzmIhw\nH14WIHHVS5q7z6CULs1466S+KbCB4UhpR65tEH7tkxsSd+IO952hdUGORwDP\nW9TnsGsiffV9iWHAlG1DHm7CWx6U3h2Q8lwB0djj7HtllxLD7Su15GbZXMJL\nc+/W+K9cRpoHlEBgCZ72mHTovlRXMZ88m504L77vItqlby2ldcr8DjZbi7Ok\nzJYw68ch4ZPzd5Q4YFucXoDiUSHt6QKTGjFVpg/wf1r5sYxlPDKFLHoRoJ2u\npbh5\r\n=sgWs\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## API Documentation\n\nThe API documentation is generated from code comments by typedoc and [hosted on github](http://flitbit.github.io/json-ptr/). Read the docs.\n\nWe welcome new issues if you have questions or need additional documentation.\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"ef9842cb779dad43d51b0e3f1f0e39042fed723a","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.1-master.ef9842c_1594413265011_0.6144556336291473","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.1-master.6759cc9":{"name":"json-ptr","version":"1.3.1-master.6759cc9","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.1-master.6759cc9","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"291d16fa1f11789b537645072c9b9850687092c5","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.1-master.6759cc9.tgz","fileCount":17,"integrity":"sha512-J6h1ySwlBeUnf8ap8ONUmdSY9l5RcrMuoGjgX4mk/QpJvdVAeDQ7+vwtwIRwJlRH5X+nwnUxp6Z7FWA7I3kagg==","signatures":[{"sig":"MEYCIQDug1Kb7vcamQWAw0RSftXHxSls9K/+AfBRIVSjWym8lgIhAJZPT9tnZUdLJaxF2rqzFJ8eowGHS7GacBo9I4iM7knj","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193001,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCy7SCRA9TVsSAnZWagAAkcUP/j+oHgoUZ4BbEBTwbUEQ\n9KCFhN+57nn7ASOxUbPt7TPgVstWHflaXlBHki0xjbKYxQx9fB59Oc50DpVX\n9KDCzr5FfUBXjOR9Zlvynhwki+uuHhML8NQ69qWYtD/SLTf9yBwpDCW2crqj\nYwXSHlQKH1TzZ0AFr1dhBTCdJKb//agXYpxy9SbAMNifRgOP2CQcMV7U7mdz\nw4st8r3/erHiL/aQ5gaOU2Vv1+Oc/HnQbjM8rTB+4ga6naqgVsGMj/0V7oO9\nLMhG2oANODQiEHTirEXW/6m6E6WO3qmI1M6ciBZlFRNMTFvjp4zvIQd1i/4r\nwp0rDaOXwyHGKOPh9TxtW9AsKUQnVWOLFADMiHY4uzS7c2sFQ6sKrR9steM0\nVSIUSIha6RpoOkCJYPLpjrNL35qCUGFEeZPRiFwxHZnINDUW5CRApUDm6UCY\nt+DpjQhVTpag/hMh+pysmyqaq1q8BhUM5yEwpvLgvxmZ4wFrLVL9e3I+W5LB\neoVzYXyMB0mUWfRw7wACEi6yQG/TrStd6dWhWLLxh5DCH66STN1/LUT8Fhd4\n3dgttWmrxeLdN6oTV4XwRqOJ1DBfUmYzD0gxVpwqPKllt7b5lyPvarqqQQwq\nkBqvMPAzureUXve5hId5weDvPTLRwpHA9nL992Dm8ESqFr64TIOVAtyTyYuO\nq2pY\r\n=bO6K\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## API Documentation\n\nThe API documentation is generated from code comments by typedoc and [hosted on github](http://flitbit.github.io/json-ptr/). Read the docs.\n\nWe welcome new issues if you have questions or need additional documentation.\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"6759cc90c6c22b10c8888c53f28a0ebf94db25b0","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.1-master.6759cc9_1594568401546_0.7072396553823204","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.1-master.b170f35":{"name":"json-ptr","version":"1.3.1-master.b170f35","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.1-master.b170f35","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"a01a7c2760d5a571a5055ec660f2061cda3bc4ce","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.1-master.b170f35.tgz","fileCount":17,"integrity":"sha512-AxQbG+JF44pL22AYRToOmyCgtUDl/R7qoQnrcYc1O/1wMRj3/gOgw3NzlHzv9bBs2YTnWwAgl9+ZewmaHrJT1A==","signatures":[{"sig":"MEYCIQC7ZwQaQu9/12pWV9dUDfOTpdUjZ9GW34YnrojrqGamvwIhALksxMjI+bCaJFpawsutKobQw4wPM6BS9CBKlOUpIWn2","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193164,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCzF1CRA9TVsSAnZWagAAKYwP/RNIfoa6stEk6Jy1YD35\np4n6kVFqnfgFhjRekLSzkxve9waSmj8aH9lRqdptRocQFkuqjyWUmL4n6O48\ngV/0G7m59DZsYwBVg8Vrf/qfNivld7Zompg8CAAx1hehiuY4xmRgWpythv1K\nduhJO0R8n58uhojr70P+DzSv6k1G8CTa7CWyN7MUR+3MfqoNDSgruNtixgaZ\nGXqqKD3aadPfTkzEoCJKfDjJTfwsMPe9lWoXHN502eA3uyCD9bgXTFNrRmgP\nPchIjqclCcObroNASUE0b+kpOU7PSH5Bgyl8ovyxahVssjUAn2UMvRMhbH0q\nQcE4180niBO8yFAKwSWUPbtT3T7Sm/UbB2IQrYh/EkJ3B9Tuhj8XhhZ2JmG7\nGh5NUprQ9HNGZKoCZbuiNB7wci+7Vk4AnM1UTDy8I3AGdcsCXT8j3WojN7wX\ncZ8wgkP/B7z2ZQ3cB5SdLdWYOfwSF+pn8R7hyVRfY4nr/mlNxFMBhU2W0Qsr\nvSC6tsA73e7Qq1w11FkCtb5DMv9OUYIZh71a2uR69AzoGOyqq9KbAbvLa95X\nmpS4hfeLWgQsAwNegglasFCRdVXxGddsqlV+wmPAiNcf8AKaBGgrU2GvcpRU\nYkJoD0DXFs+nYLUgLQ1Xyo5J3JOrFW2IPqykhDNVnTFgIbCfjcktB5804jAg\nj+Yb\r\n=5f+l\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## API Documentation\n\nThe API documentation is generated from code comments by typedoc and [hosted on github](http://flitbit.github.io/json-ptr/). Read the docs.\n\nWe welcome new issues if you have questions or need additional documentation.\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"b170f35483f6f4ecb7804548e2a4db53efe5a957","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.1-master.b170f35_1594569077010_0.5459273399217488","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.1-master.ed42d86":{"name":"json-ptr","version":"1.3.1-master.ed42d86","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.1-master.ed42d86","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"bc302390d3d23a246b4b35768bf78e055ff9e0d8","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.1-master.ed42d86.tgz","fileCount":17,"integrity":"sha512-VUg8p3AUcFbUQHnreUfgzmxK6mq+G/Q98tbkROdU4Nsd2LnLhT+vYDbnlgrxzuOGVh299Bt6fEspEeOBzqrUHw==","signatures":[{"sig":"MEYCIQCXSzYVysmKP6Beut/GRDk1d1bKbk4aE09iKZ3ahXpWUQIhAKbUzyMgoDK5in6iisg1V/tG+larWISCKEql9iJwZHbD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193227,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCzJGCRA9TVsSAnZWagAAbLoP/Rn70r/EKnOyAwTi7YTm\nUVBegkBqBtqtKwhzrpnuMLBnshyTyJuVGNlOhTayn7BXZnB0lg1uHES1+bG3\nQWJaRDBqQosv8xTTq4P9vztIOUnkJcixxW7AOnwc5wax9t7ya6HJ14vup3co\nUDsAEv0U0y9CP1PRKJWt8cnmoR/DPkzFIhjWrUPl2Swr0Vk+WkuZgw7vRizp\nLPEaeinKscTO1puf2kh1Q9IWlo9SW6XgVSesRKqituZh6e8idZWybyBrxfQZ\n3V1sVquPFH5Xu4foTQKctPzoOQFGbDiYQWUt2ub367/CpAxoZXcXH9Jtagj8\nun7AOAZ1GtqVzNWPnlf/qno4mI1Upl3tmE3nGpAWcT+i2O2AaCC+l+nc0c+g\niQK700agkFz+D684Qj7/qx9b0Lfb4xTDbSOriy+2T9A3yT0Ci8DOSlG7QMQ5\nC/IbBf9WJmApaCZhxk31p/vG2slwt5YzKVY2Pd/JYtCsSwep1YU06FUtaCwT\nZKgDth+Tef64puMVQlp8RmUbuI98kWNb2ClkbqgeFo4//yp9xp3Trma6liNU\nMvhjAJ9RgYETZ9a93DQ8t1wWbgAjSgTkHH5ygJS4MgqS1sgn5om2PU0+PqHo\nGGz196F3lrtdwSBpUXx7Mi3p13S+RrY2FPdLsAP9Bf/9wx1DEFXoz8fcn/CH\n1o3W\r\n=kB+f\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe API documentation is generated from code by typedoc and [hosted on github](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"ed42d8635157254df28717802f1ba11d78914a62","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.1-master.ed42d86_1594569286318_0.9173038091033896","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.1-master.045068f":{"name":"json-ptr","version":"1.3.1-master.045068f","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.1-master.045068f","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"02a6ce1f137b192eefa9b66cbd2da444bc4f2b1f","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.1-master.045068f.tgz","fileCount":17,"integrity":"sha512-hFnLrhzCPcleQw420jERA5eqxdX7jFFT8i8MOKWR45A4rnuz7hRSD5DM8Lq3vv4q9vIxbcRzcJrAnaJZC8PV7A==","signatures":[{"sig":"MEYCIQCaWODX/lkIsTlWg0xGTqh7Nzk9Lfys80afbfoihctjtAIhAM2GjtgyrS9Qa1GcRpPLyqs+tOfWXghxRnc1Lz2q06rD","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193222,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCzKUCRA9TVsSAnZWagAATzgP/1SvpvDtR9EvIrxyxWu8\nLui43KQObarn0jOdHVNoFIz9uE1XEkGDAs6fxXFa7R8cgJBv+J6KzTjalcGQ\nJVKdarzKKXi2Uzg3yGOIC3KH80KtQyWHmWIfzXeYjBWGpqHwwEagX599Zf0o\nmS8yrCKdgPQcCbStn+ZQiLKCytq/OZNWkL9qI0fd9NTwJKxnU4wCO9zfSrkl\nrcUYWObfo6EwCYyUaq15Al2YanDHlnTrPRaVnLYNQxypAY1omSgvM3oQZ97t\nVcctUTSf+J4rtlLAGiFiknvPF38C8KEn97pF1Y4S5T2UtMnafduq0wCZr4OG\nd7uyI0zB+GUDJTJHzhgnVUUqylxV4DAidl0oJDHHWueMVlg0es4KGhAQo2tJ\n3R/iMahq7sDJmzQqWsC11sW9onseePpKx/N/yVUcAUlbL8UjSTZfXtIXZfzH\nMM1F5P2WlnhTiMw1htpTJzL6OrcRictolS0kRFvZnVjOTPWwMSmWLMHVqadj\n7gqZmGSDDArBSAP4YL9+kks+sU31GTFwT9GHiB6KJQNINLbHtCVX61bmnZQc\n3VXP0QzguYtBv2FU5ROijcA38QekJJN9FwKiw4aD5wLoV7WhmO40EOiAz65t\nF0YTdYebCHnN3PAXeBPLH4Y9gjDBTpSGe53B5wLXcqMdffm3nQvrePDZGPxY\nYUzP\r\n=cASd\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"045068f45cc069fe23045ff6b8c735a3a4a774af","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.1-master.045068f_1594569364036_0.9317263935556757","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.2-master.3531b8f":{"name":"json-ptr","version":"1.3.2-master.3531b8f","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.2-master.3531b8f","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"753aa4a9658918d87973cccbeb151c37c75b805e","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.2-master.3531b8f.tgz","fileCount":17,"integrity":"sha512-NDw4Fw9uBbSv4X6PO2HmBOKrahaMyNWcKJ4FvOrgmukc9hrHZath88P39dVh+/WEU/P9hxV1+tHeg21ZipeZog==","signatures":[{"sig":"MEYCIQCP3kcIgsfsUNH6Zp//w3M6mApsNXSAYvS+dxFqRP1EaQIhAKR1fyUFUZHqXUDbpQisg4I00qzXZ6qqm68fzPtI1R4F","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193222,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCzLlCRA9TVsSAnZWagAAMHoP/jU8PFobWeqbqOoiN+jx\ngDqgjYNF+h07PFTPg23VyPZqz1aN9Y58UA2ktCFN9/LQ4G9FKQijc15D2tK1\nVzG2xZWKw2XQx0pH4zvsMdKGzflJzm6zzzu1r6AUj7JSmo0ey2FCJjBU3ml9\nDeq22KVNkk52EKVsrq7lOyV2cL1r5K5G7fCelvvhCDBV1w7zZf2LSJbGsxV8\nazqcKViVXgcNltdWLg5JqYtuSLG+RUOq6fkHU1WhYDXHWqSdCh12fZTQ67oD\nqVADeTT5YLF5sQsgaDNprtwVw2PjfBaCpmSOpk9Xm3ucc62Xwrl6PlKst29s\nYHhH6ry0pk6XAm8bcIivd32JiZqy9WJZ9EC1iqU3Oylz9v02L2Nvi+lS/gpR\ngofqNsYbBaIDGD9Xh6hnYUXsWk+K+shiHz9daXBUOvxR++s8jh6+ZVqJ9JqF\nz7uyPbUMt4ZAyJPkG3++JAmfnkNsRT8ymg65dm6UeJ77XZEigdufZ3Jjscvz\nwqMSEJs97+uS2SUytvPWhlWB+B4+QvhpAF9z9p39H/R0YV0H4c5rk4IkYEDr\no+DSdhRl08XUvRkxIZKgRMGsIJS9VDKpMDQN1Q7xgP/ZOwzljBwkF6r1ey9E\nzP0PNbElcC6o5GV2sN9fZOHhwWdsyGUcbxJ2bo3d/2oHpP+m2nK0DPKFyzWU\nmq3J\r\n=/7Z+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"3531b8f437a5bec4dbc6d359897af00895d4fa99","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.2-master.3531b8f_1594569444611_0.5038908449997948","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.1":{"name":"json-ptr","version":"1.3.1","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.1","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"0da62849d014589dff2c5070d2611ee3cb6b070c","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.1.tgz","fileCount":17,"integrity":"sha512-RoTHczqQoT2UsJINUvyMEHAHxGDq6c4/xXHwA29iArQMGIv6pFqLsOJMeagtnY78vsp5k/+9JcvmKKLsbuDRBQ==","signatures":[{"sig":"MEUCIQCMBeg2T3GxNIwd/jukXSzt9T0AUDtE1Bxi/nXnatrgCAIgRpeO/mSQa3B2oWFRplqq23z5JIF1aUxZOy03Mk6/h/s=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193207,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfCzL+CRA9TVsSAnZWagAA7uAP/37rC43jQHOiQKVk8iob\nymc3CcMgjhGNoDvaTTYCoYehZO9+0RfU2GAOh6NFayNXInRdaO9JH6vsw0cd\nCeIl0DbgyChQTQaTW77ahtWxXpEgjIAvplIejHKpdVDKDgTMby/65GG/Z5dx\nuevy1lM4AM1oTGSXtemzgCYA5SEbGcrsSgUu0/sLGvwjysQhYuHqMQOiTPhU\nYY6yx0kBqd5+N6ElBoIsHadvk/xxN0x0PO7wlM3n0tb2p8ZsnY9RpcyosqYs\nHaIu/8Sk49fIxjQWj9dxEl9G9844k3GwWbkR9+FNBbHKUaHuqQBZHG0RiRX9\n5/kBKmR1TeL/DN44sIB7Tf4tpF2dbzOEnNO7eMzatTJYy8A+z/dE0CddUGUQ\nZMjCwGXkeEC0RASHyUYdYdkmoBYzHV172hhS9PrY0lJxTMy3wmL4geA3xx26\n1n9uGh3gTfXYwzjCti1USzPfVOlT1cFFb5/8PzqyRVnmt4AXcAT2WaWntt0U\nvccCi23y0tZSppwTEc0VmEG8DepV56UPKfneUYBucCMI5mTi6B6GsF8lZY48\nw3VzdLIXPqQn4n4ExMVaBzQW7837ztYM3ADo5nR+Ps7MeL6/oea+tVnq9GJ3\n87BYlXiyy7jnJE6C3f47b60zPHJ8jtg1pyO0uyCLYd9w7eYVyo5Rm5wED1aL\nnUom\r\n=LxgF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"3531b8f437a5bec4dbc6d359897af00895d4fa99","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.1_1594569469496_0.2549400848767138","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.2-dependabot-npm-and-yarn-lodash-4-17-19.7fd4b3e":{"name":"json-ptr","version":"1.3.2-dependabot-npm-and-yarn-lodash-4-17-19.7fd4b3e","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.2-dependabot-npm-and-yarn-lodash-4-17-19.7fd4b3e","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"0451603056c8a97e10a9cacec3477cb2ad821045","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.2-dependabot-npm-and-yarn-lodash-4-17-19.7fd4b3e.tgz","fileCount":17,"integrity":"sha512-AvRlSnEoszA8WHXPKBi7dnOCTiNlJLooHqzXR8lxNsIE2AiMhmIomlJ7isHTgiUIBJ+smQWsIEW2eYv6Q0nZLw==","signatures":[{"sig":"MEYCIQDrnms8omkcn6B2voJCRgi/3Z7ZEkPGFUTCbrE6ROvSDgIhAIoBVAO8fW1T8n3KhV00J3IHuzem0NdeLUgQKYv0faaq","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":193254,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfD6mlCRA9TVsSAnZWagAA0ksP/166597k0IncOoSz7vIK\n4KGbV0rLP5uq/k2eX/tnxgn//3xGgXlKa5DLd381fUHYRwfLC1c126x1MZFQ\nE4Y1fGThDLy/dafV28uMlsx5ee62QP/8mOasIoAzXx5gVdd+e8Y9eKrjJkXb\nMceAEpzFYrJe+vmi5ikdtjwxkr6Nul8zANXx3aSRBYtg0QoeWVgOTi6lM3yO\nwegvKUc3vGHO7Hz82usYErwVt6buj1tf+MQSOchDMaLv/Ph0vvWPfB6Op/X6\nNj9ok0NlxAARcHQu/LzkLr31qPSIjY/wD0XjKbHa5psrE4J1gHUbygkyguuM\ndjMrGPqxcSObAnoEJcHa1LuBE+rk348O90vVElI70B0owxFdTLAZR//DNbcu\nfmncfEeThvWLTqaPWnvpxgrbbZ3oU68wOXmmd8nwwWepnqF4kbveLBpFdIdp\nyvp+263Df32SjZsMlEHsCVepTb7fD+7VATZWRNyCo79pZbwihVBuBC8BmlDq\n+ZrwcQ2ppEshxBrEIbdOKSk1kjRHCkNWNdHSJvwISdKednxDc6UzIBdInKer\nWQxN0Zwb+fbnCeF5sIjWAMzbvHaW9HIvLQHSzY+vODCG5sa4zdm9Bb3AhPGl\nCNRVHMLArfD7iV9DC0yOKA6Eu0VeV/LrehDH2xGlFQohZHehcfU++V0xjoER\nONvM\r\n=mCAD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0**\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"7fd4b3e1a55e47af563af3714d0b1cc8d22df81f","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.4.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^7.0.5","typescript":"~3.9.6","@types/bent":"^7.0.2","@types/chai":"^4.2.11","@types/node":"~14.0.19","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^7.0.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.0","@typescript-eslint/eslint-plugin":"~3.6.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.2-dependabot-npm-and-yarn-lodash-4-17-19.7fd4b3e_1594861988446_0.8158475428547018","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.2-master.b8ed3fc":{"name":"json-ptr","version":"1.3.2-master.b8ed3fc","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.2-master.b8ed3fc","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"25e61b7ea2601a6221742ea058557ba7a598c111","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.2-master.b8ed3fc.tgz","fileCount":17,"integrity":"sha512-JiP2CGRmUiynNGGI0dFCruFGSsL6os9WlAAMCxzNOUk1FkkRzqzXgpkcjSdgVULkQLxZBP7CCZKkPfL+kV2Byw==","signatures":[{"sig":"MEUCIQDIjw/WCvnSXVu6EoVyCHisCkk9h/C8qBN9ehyRgMgWigIgZFZJUgeO5QUMzAT50QK3WBT7vSuO1RKTi0jhGbsFgq4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":197916,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfFK+4CRA9TVsSAnZWagAA/xkP/AwIUz2sati1G/OeW12h\npeJutluaqUv7C1a7TxCCgDxBGIAOgc460lpJEONZFEj3tR9uWyJrEKfIsqMD\nTxuf6v5am1nLy/qpV+7jZMYc9vi9eeYK2dXgRZzfs7PnZ9QP+eApd/fuKmMT\nuqapr3XuSL8yWFnul8tybwPJJu0cjI7gjl6Ra5FtvVgYfmRmupmxEBP/ctrH\nR3oa7CzUWCQ+Qfo0reGBogJB2dcKHoKAXFzUuPs0XrJy4Q25pb6iPZ9YtaDF\njtaoacO2dM/vd2zeE2KXpuj/7EYw8ZQMjSyCK0pyYpn/EVo60i4ZBxmNnKOv\nbNGMoi72HdphaJho0Zi6a8nE7rS3i+tUy5rVbCb/46VQd0caP5w8HzGYqzNF\n+ITx0QIt1wJ3d25qXRlkmlN65HgZAOYIGe/nqXmTSA6tP1Q6gN1D79MBV+Im\nfNm/cFNLAVwGSTCoPWHbdWTTybwC4ML97CkjW5JxEY+Kc3N1DIZvIt1WhJav\n9+zbPDnp8Mb//qVGEPk1hQAf1WrwAjWSDG4XCn5rKhVzA8bx3j6L/iK7E7VR\nq4IoZSEvJIXga1Aq9Nwt77V4Q6vxV1aQWQgbzD/b1xAZkFD/HoEG+pEFr4PK\nNer/4LWF56SD1/ewz+5CNX74dLVmhVeNeHcJqa+MIVSXJlNtqFADShEFCnhK\nI4Ae\r\n=SHV3\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to the `JsonPointer` class.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-dit-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"b8ed3fcc269250f94d74ac603e046d155b55f63a","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","dependencies":{"tslib":"^2.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.5.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^8.0.1","typescript":"~3.9.7","@types/bent":"^7.3.0","@types/chai":"^4.2.11","@types/node":"~14.0.23","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^8.0.0","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.1","@typescript-eslint/eslint-plugin":"~3.6.1"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.2-master.b8ed3fc_1595191224394_0.959939992678033","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.2-master.4077c81":{"name":"json-ptr","version":"1.3.2-master.4077c81","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.2-master.4077c81","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"3cd644a19a34ce8e9f1b2c95f3585e5b091487b7","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.2-master.4077c81.tgz","fileCount":17,"integrity":"sha512-HfDle2SEaeHq9BC4Pec2uzrabpa1lmDijRHFVWz8ubeh6nLlkdf1JlTcgvTSlf4eA0MjPPCOr4j4suRVGOJm5w==","signatures":[{"sig":"MEQCIBk0T8NlRDr78E5PS8FZEl6/v9Rp+I1bkSERxfz1A2lAAiAqYEWuEhdJqCZ9cWFC2AeViB+ZK4iwRiU4T3H98ZpO8Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":198549,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfFLMMCRA9TVsSAnZWagAAolsP/AyGG5Q1cSMMEUJ9KN7y\nLNDw8GT86D1hSwvnH9AygVcR9F6VKBvQY0TPehlaCufLTAQgl8w8wYNQoJUQ\ncPhRFj9t2R9yPT9ck2gP+Y3ozWlUgcwnVfq9H6nF78U0zeHczwIvCxi0zrPR\ndDH2pe9BVfZ8dX9qp04hlXWSBEXrrAbAmHIIFDjEtz6cJ4vEgQ75EE78gRRC\nfNvLAStcHHnUNAH3qzEWbc59rFBtZ3GgNoR1VHLJAhmZnTXI+L1YDjn8WmS9\n4MR65XzB9xzc6kSTRiXauIOWuN6HsjPrzBd2TsQJURiX4csagB/Svp5I6ZH6\nu9BPbNMyNen/8BO/7InETz5pqZUGXP06qWcnVx490qJta27ODn9YGDebpgc7\noPoDCL96gLNoWZUhqDfc6AqSsyKRHoJsxzzzVNCe9Mv+S0EsRvXtgIenuwF4\nk7TdpI3wKd3shstlcy9DfOhXA0Y5KTqMzwg1anDrjqz7CSQageBihRiObXRP\nlxjGciHF4haNgHKuraR2t+zt3p8tz94xdGHn9GoR8Kk3TTVo6hp8lVRoaPHC\nZajjwlDi6RcMr2pLnPrVKk5Sqi46TdZJx5myZIOoyeBR1HWLUpg64PaKmLkq\npN01bTmEdXFpALGNEh2Z57J6DsBwCtADXt1KMAZAIYZx3srdVWLfvipvZjEV\n1yID\r\n=8GUz\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-dit-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"4077c816741b50fbee4dacab1190e60bf6a48401","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","dependencies":{"tslib":"^2.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.5.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^8.0.1","typescript":"~3.9.7","@types/bent":"^7.3.0","@types/chai":"^4.2.11","@types/node":"~14.0.23","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^8.0.0","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.1","@typescript-eslint/eslint-plugin":"~3.6.1"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.2-master.4077c81_1595192075589_0.3828382077417103","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.2-master.b0d7d5e":{"name":"json-ptr","version":"1.3.2-master.b0d7d5e","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.2-master.b0d7d5e","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"9c3537a8cf896ff496010a55fff9916faa03b769","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.2-master.b0d7d5e.tgz","fileCount":17,"integrity":"sha512-ys0UWHYTlvUlPfKYsf4wffERVMePhizv2W0Jg5FmsC0LmhGKyD4zcTCNVjtYi1NKuF3LyH0youfdhKm2tK0NGw==","signatures":[{"sig":"MEYCIQCuNgTUgdDapbqyM4ow2v3/qIpKEop90xQ1zN89kAIVJQIhAPwRazuwxq4hLpKDwLeSJieyEfUwVO3zfVzNfZqPnTRY","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":198549,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfFLN4CRA9TVsSAnZWagAAr4UP/0t/Nf1ph4KeiMOB8eVC\nhTHW0pskK+B8jmoqsaLidePB84OSggRkmUaxmUJ5Fl6zXg3lJ2Bs4pz12M6A\nMS7llxoazcAJaJMHu2qAaSvY3U2NqogTCIRpr7D6pwcdekW+0ocGTyvjyaKi\ntNXRnF4sDxb39bvD50zhojWmD7j27aOp9rbhRUEhUWPSKl1X6NhJa2VeXrnw\naOrDydBjsm/qoQRrGmbFpC7N0MkRCn1UL/NfprooejXpXFj4gACpSXDPdvZc\ncysv+ZZD51lQay7JT4KCd+j/ESKLPdF6jpUSbHhfA0kx13ESDwoBBHDxTUcd\nJn5fnvR+wnRB1DBkWNh44B/Q9J0jy9dZwvUC8xPcCdbY8TyAlAmZ0NMTDdH4\nWWJ8a6a0HvX5AEuCH4YObAtKu6rkRroxYVdyEuyPiOFB3yN1AHgzDdpjiEb7\n8FW5ETAYDFCYtEtearVqqPAdBf/jSZ2rBelsUHqpPxMKUkZfBsaFl9o7n/iu\nqs/KtglG/LThbvq4SHoeV5r9tNru/7oqwfPBT9r+30kdfWasiZINyOWIEWls\nahWOG/PPuFlobM6yCTcYkmQsE3IOLqK0xeyrj3eB/xA6yxJ5WcNwkMhag1AA\nJYFHZGsFsOeY+4/dtM9wxvQed8FeYZgi5KnHrT1NQrF7Ag6tKVuuw6cVRwqi\nEAN5\r\n=hktQ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"b0d7d5e936f3e70a0e3ce0407b878a56d5c1156b","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","dependencies":{"tslib":"^2.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.5.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^8.0.1","typescript":"~3.9.7","@types/bent":"^7.3.0","@types/chai":"^4.2.11","@types/node":"~14.0.23","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^8.0.0","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.1","@typescript-eslint/eslint-plugin":"~3.6.1"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.2-master.b0d7d5e_1595192184574_0.8695547563149519","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.3-master.10cfb6b":{"name":"json-ptr","version":"1.3.3-master.10cfb6b","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.3-master.10cfb6b","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"c3c2ec749bb88af4e89c41ecde08bb8d80084735","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.3-master.10cfb6b.tgz","fileCount":17,"integrity":"sha512-LKEqeM0wpJTgIGZoqRM1Jgo9SgPjeBHU26fav62toyMk3aWezinrjMVg4j04bAwSXKP+UCsdRUclCA7//hEWCQ==","signatures":[{"sig":"MEYCIQClBKnTYPlreuS865R8iwQiMZrMldUM1mdfLOj6S9KX2wIhAPnx5okXgA9iI/WxesgT2OVVgZ3kULPVmcY2ma/7xDjo","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":198549,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfFY3zCRA9TVsSAnZWagAATFIQAJlnj3bfsEYQw6O7KcIy\n5kYZ5HaIsJmKzGXVMqoiyKb8byGRnpQA1c3m43aQjK+8jJDIxsRjJxWqvOkK\nlnXP1xAzASlwan9M0oOJSs3BnlPKLdqPORZgLoybztVmhLsCRrTnFKkYNlSg\nn0CHDF/eUYZLrmq1foeRy1vPgEkC9TbUyAlZzQizblt9CLIyJJLi3G2qVUnC\nwqbMaWC+Hd341lgaR9Mw+euVZS+/2DJ5gzCwNvfKq1KH1LG8W5PPqWSirtxS\nb0oYyXxMVZ3ARr6cFlk2DDFSn8vfL4Fus18e8/Lb0tJvxwfigTDKN1/04Gke\nS2oKKo0F+FPwODdEwrL59axUE/+5+apBkjyfOTrgL4l3GJw3B1SIqtR+fB6o\nIFPlI7bOv60cbQff3yn2Yg0Att+srgfk+UkXdmSQHv5vonkC5MN1VsK8w6MC\nKq7hkO69HxgeywfOaGz9ZiJUaxwrfs7IhkzjRxg6t3WVkryn6Kl/bxAJ68Zq\njk1YWQALmTVn7YL2Qq+S8t4/dOUpYJt4ebhWEzuT0DPFvEeNmBY1qDMPxsMv\ndlOaxdsHtduF7riccqfbEoQL+irewiTnXDBny8NtCBQ8ETcQr1pQ052t2SO+\nNgcgYyzpgKTO+YoAVTgd++PB/fqkMqO4Bc4+Xl3DesxNDebFaQqk4iloQANZ\nkf0Q\r\n=n4tB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"10cfb6b4cf33991cd0650211131154cae97f94ff","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","dependencies":{"tslib":"^2.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.5.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^8.0.1","typescript":"~3.9.7","@types/bent":"^7.3.0","@types/chai":"^4.2.11","@types/node":"~14.0.23","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^8.0.0","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.1","@typescript-eslint/eslint-plugin":"~3.6.1"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.3-master.10cfb6b_1595248114549_0.3719567482945554","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.2":{"name":"json-ptr","version":"1.3.2","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.2","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"17f45b322a843b1f2fbcc9b45132bd9b3ba8cd38","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.2.tgz","fileCount":17,"integrity":"sha512-tFH40YQ+lG7mgYYM1kGZOhQngO4SbOEHZJlA4W+NtetWZ20EUU3BPU+30uWRKumuAJoSo5eqrsXD2h72ioS8ew==","signatures":[{"sig":"MEUCIG6YduCpjcY2Sz+eowpsN8Q7u0uVrj6Te2ZSWxCfUSwnAiEAubeQpkTkgYNVrL0DuJcPKIL2Mhq5nrAD6LzOkygeUR8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":198534,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfFY4BCRA9TVsSAnZWagAAI4oP/0CUwzPIJOUSMJaEDIlp\n7VZ2grim6DGF4+MNHn7WO+1TlUVo3DSmkShfAr9+N7VEyWtdjnCYd/QU7NpN\noqBOwWR5GOXpSaOwVjUR1Tc5dyqqEBytE+z3OI95qRs29uCoaUr0IzvPJwRk\nCrozPwZbyK5wTVbcuYs3SmjRbx4pA52Z5sHeFyS/mEbGTWfNoYbQiirAKK4b\nJ6MCge5GxyBOZf6BhcBSQZGfkIerfzzGvA9BA0HTH9pahIr0U41/s0GJ8VfG\nbrxAwtsZseeOsqqsGUch/Kd0IEJEW3MkSWAULB5E48wtiy4560ULCMk/qMH4\n/dNyKyIpJTjP1mMkcQ9gPrYljweT3TBvVyQVMhDR6kXQ2rSwylbCJWMbxn5l\nn/3Lc1YoVxKK78evAImjDKpUFV812dnQzYA6DGKIiqFSkkTTrITB/ThFkEfR\nxO/TZjIpoB993xIfyryYtfg0fENB+YecswlUQ6cqHb61mL8aP+MN6jGPvxXU\nrhllyFqBrIJdAQ+tQWEelfB31CzlzNsx9skEdT9iFMf+2ucXDt3isR48VfVM\nhpvkIkc7k6EbaiJrRa5v/PN1Wg4KvZ2cooJG9nRl4eiAN/qM+vZMuxe/yhJ2\ntsN/BOZoLzh1JJjiYbmfJERXa4OYupt1JhUUtMuPdUPuiRktB5h3aUm6YvIW\n95ff\r\n=dNGR\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"10cfb6b4cf33991cd0650211131154cae97f94ff","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","dependencies":{"tslib":"^2.0.0"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.5.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^8.0.1","typescript":"~3.9.7","@types/bent":"^7.3.0","@types/chai":"^4.2.11","@types/node":"~14.0.23","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^8.0.0","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.1","@typescript-eslint/eslint-plugin":"~3.6.1"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.2_1595248129243_0.25783289395949627","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.3-master.983a133":{"name":"json-ptr","version":"1.3.3-master.983a133","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.3-master.983a133","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"42f6bdbb1b016a9b83c8f7deba2b3a5fecd509a0","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.3-master.983a133.tgz","fileCount":17,"integrity":"sha512-6X/nf6NWPhOBsx1GkNoMkN9GNMNA5xEYEI1X3F8jMVbybGlYn8pCQG7Zs61qEqftZbe6AoOTM721YzHNyKaliQ==","signatures":[{"sig":"MEUCIQDrI7m/5jhMBQ6IZ0LDR96OIHqRGJTP9fDkUzcvWDkLmwIgfRcTNV0wxg/jWGrJM8Qny7bBnglJoySkwVaErd5Ewkw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":199163,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfFZZvCRA9TVsSAnZWagAAVyUP/iFsemNnarCqenDLtXNE\nP7riJ6/sNEI1goDjAHN6D4EYuzpvRNd2tEO8qm55r7DgTnONDXgWLPQ9Cd4M\nMa4ZLDROOcUvkEIdCoD1V09eAeLsUbhA/2Jezv1W0jVtmjfC2kP7pPi8QcI3\nSCngYavy43ccPAQWZcejCTPmfm+fbTEYxlFXN8oYFxkQH13iHAwRgZdnj1h2\nEUc2YAkFcntyVLeNyw0p5g6llLazk4cCmuK/jgVZMv7Fek8I7oIv+Ar8GsTR\npBpvKQstZ2eOxVoqqHE7QNFC8/3r2+vhRkgZGUKrZbvYO4nQLWoPlFWiohvH\nGm0EY3kMsc2jY19+zYWBXWglfdGcJL9cl8C5SYPdEIQlWxSjjq7S4rZfmJnm\nFFX7mUInovqLN5sLxZC+ejTdReGSkrNSLb4bGlmj/QSNcKsaijV3jrB+OT/v\n/OBocUam3O6BfuHQ/6prat2nQ7BVlB2uh2/226DsEMUqrNpm7iuLKaC7QNsu\nWgrttIUd4bRV5y0Dq8qTHNp9bykLw/H8Fz1lCSYHNl0wmW7YuaqxgGI+BDDQ\nIl+4Gk6i4AC5KMZ1s9EDRdP6Y8FgXLurTpkx+8t/3Xah/VWCGLenWau83OgS\nFFqHS8MuXNpvJtILtwuueqbnYg/6X5Fg0F5Y97MWYu8cx/+duKBax9hAaxjH\nkRUN\r\n=sr8P\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"983a1334a5069a4ea49df2e3b4e8390508655335","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.5","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.18.2","dependencies":{"tslib":"^2.0.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.7","chai":"^4.2.0","mocha":"^8.0.1","eslint":"^7.5.0","rimraf":"~3.0.2","ts-node":"^8.10.2","typedoc":"^0.17.8","webpack":"^4.43.0","prettier":"~2.0.5","ts-loader":"^8.0.1","typescript":"~3.9.7","@types/bent":"^7.3.0","@types/chai":"^4.2.11","@types/node":"~14.0.23","webpack-cli":"^3.3.12","@types/debug":"^4.1.5","@types/mocha":"^8.0.0","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^7.0.1","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.11.0","@typescript-eslint/parser":"~3.6.1","@typescript-eslint/eslint-plugin":"~3.6.1"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.3-master.983a133_1595250286695_0.24949970773447783","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"1.3.3-master.f23e2e5":{"name":"json-ptr","version":"1.3.3-master.f23e2e5","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@1.3.3-master.f23e2e5","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"0f021e5cea20671c54172d0b2b8c84a1cb9f9aa4","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-1.3.3-master.f23e2e5.tgz","fileCount":17,"integrity":"sha512-GMAGvxctxX8mMK3vTv4DDH56U2DDnB+YPncJyuPgYvmRb8fbLUG5bhINQIppTmP5NkS7CWGpD29SfFry7JPJxg==","signatures":[{"sig":"MEQCIHL6uvHfSOYGTwPElCXOS8ZmW1IAXt6wM/M99aLoLyI8AiAZd4ojsjbVNHf2GmnHEh3kIT9PJxQMRozi4fnDtXHIHg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":200052,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkINuCRA9TVsSAnZWagAAkmwP/iNkfr7MuefkZYqL4GU2\nSWiDhnx5/aeGxyDG2srENdcDai7ntcqd2nZKGwnQuT9Picpp1CsqkhHdFHwF\ncxszQjyCKr0VbGMKovzv21MpweO28BqnSUUQuomaQHDkmYoKERBCBYd7ylWc\niSK+idTyrNh/vF5ajDAc2QMsVtqvxO03HI6Dzdat/qTkrYt+Iv5vajFeVHF6\n0qIH8WI4CYszJnBvN24alt/RDb5DyUwGWru+mOzAVhqn1EBukV7lUSs7Wdrd\nZo9pZ9Whkn/rgcjfgYcMDzhe20UAX2ycfqsEWSUC+9VvKV0g4vQmUxfeW7cY\nhiCTa/Q2aXhNWqmlOG7ocq4K5ioRYEmsfpfqVo40mZGSvID2gr7EwKgOXprz\nZ/ZMDnZHHAXalW3GttMU57Dbuce+eMJjW/wmjKxFDkbBiQdCT3TLVJHiBkVU\nR3CcFgSfWuCLclRqF3deu2GaEVj8Le59eS2vetT1CWj/e5qC96JK0R6DFgR1\ntgIrrxIr3HLPWGOOyz7TT75F6vqvv6Cp8Im7rug08xqIi+vYfsjKemNWZ3uG\nh2DZ2JcDifhvW/QHv7btgYL3FcqSV9+RQBUS3YvnnQizqzSyQrC0mJbCwGkW\nxSiG7VIoRvYMzEtybrHX6vZb9jn9encpHOaYdTw7tWlyRHbteA4B9kVnz6Wv\nFMRm\r\n=MQ73\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"f23e2e5a7c8ee06b72bfb6f431a45c4bfe3b5409","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.8","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.19.0","dependencies":{"tslib":"^2.0.3"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.2.0","mocha":"^8.2.0","eslint":"^7.11.0","rimraf":"~3.0.2","ts-node":"^9.0.0","typedoc":"^0.19.2","webpack":"^4.44.2","prettier":"~2.1.2","ts-loader":"^8.0.6","typescript":"~4.0.3","@types/bent":"^7.3.1","@types/chai":"^4.2.14","@types/node":"~14.14.1","webpack-cli":"^4.1.0","@types/debug":"^4.1.5","@types/mocha":"^8.0.3","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.0.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.14.0","@typescript-eslint/parser":"~4.5.0","@typescript-eslint/eslint-plugin":"~4.5.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_1.3.3-master.f23e2e5_1603306350509_0.9433973945073704","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.0.0":{"name":"json-ptr","version":"2.0.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.0.0","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"aadc43994cb5bf4e1443e3a298920ab86eaeaa5d","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.0.0.tgz","fileCount":17,"integrity":"sha512-VGP7ucQzBLJFUC8sWR57ALW/+iui9NCE2i61SULum4TBfu9664bCdWjuRkjghbg1rj1k+8+PciKbfFJdGQlS1w==","signatures":[{"sig":"MEUCIAvdFid3YlLMbTggUIuIml2HT6lr3r2FNSLiacGoLX8SAiEA5gm6yc7k1twaboTalm7veiXzQu+Yh2L6y4QYIOpdcuE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":200285,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkImCCRA9TVsSAnZWagAAi2cP/iL+Mk9uAIN3E1ac2zbH\nKmd+dqUDJDyDhVYmbLgw7x9WVICON1T9oyyXHAgxrHyOSr5x6U98DROrVawt\nKT4MnInlIogoWZaYygSUIOsU6hQTxc7wiD/Ya0P/yjnJ2uDdBevH/LIamMTm\nzb0HsLSpc297hIAJZLN2PDGxh55G7Wldy4qTAuxgwvZ24dCVb4/U+bwFflVz\nafSzpi5SSC1UVH+QO0BtaK2VC77wmhANDohXNT/V5FgUMRner4xLI3Nhkyj2\nqgw/+DJHdFGAbgnuseR8Ui3ajKvZbpeLwD1wgM90W5R/TSUQuFl7Zl+yaUaj\nhXgw7fFN1qjmQRa8QDa3LGpACx4j9+YJhV47dy7zPHv8cRgz97zPRHjU/gnX\n3e//V9VAcSRZBD9DrgrmT5wxiSuPywuBFyPapm0QgoKoDJYSJ4XD2QJXP71y\n7KFJxLl70RM49fli/olj/UDM4nt/4Mhm1cx95SlZflwjCt4Rt+9A/pIDEtmn\nEsKU5u9a29dH5wBcVCxVIAzTaNaz1H5zq1A7LscIbYi8oVxd3Vfu7/vvzzkQ\nvca3AjAC2s2bBJDzAhMf0wP/SnhKUtRePS8burjSqgVTiSpCqta8DiU/lo8l\nXRm1OaMBihKT2hn8RVj/w6jD4/uwzLwKF43Sj86WTiftQAzvjtVq2qqvRDHv\nF6UJ\r\n=ofeF\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"bd9903122e10f8ea822d6ff924e3bb5d07274714","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.8","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.19.0","dependencies":{"tslib":"^2.0.3"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.2.0","mocha":"^8.2.0","eslint":"^7.11.0","rimraf":"~3.0.2","ts-node":"^9.0.0","typedoc":"^0.19.2","webpack":"^4.44.2","prettier":"~2.1.2","ts-loader":"^8.0.6","typescript":"~4.0.3","@types/bent":"^7.3.1","@types/chai":"^4.2.14","@types/node":"~14.14.1","webpack-cli":"^4.1.0","@types/debug":"^4.1.5","@types/mocha":"^8.0.3","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.0.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.14.0","@typescript-eslint/parser":"~4.5.0","@typescript-eslint/eslint-plugin":"~4.5.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.0.0_1603307905834_0.14763967320952798","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.0.1-master.bd99031":{"name":"json-ptr","version":"2.0.1-master.bd99031","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.0.1-master.bd99031","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"84cc0a5a87e002a1ec8e806ceda8e6110fb897c8","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.0.1-master.bd99031.tgz","fileCount":17,"integrity":"sha512-6twOsq6Ww09lWIOdyy98cavk9GtEy8o/TeFfPoIbQ8iW7Xs6fwKDU7pfrCtXhuZPTVWYM8IUV8eDiRl6+h0lkw==","signatures":[{"sig":"MEYCIQDGoiXY5iJs8V3pUAeI+91lYHWewEgi0PmSDLeEZWLMpwIhAJwxPX9+NwiwNytF+zb4HC1gqC/p1HIy2eTHGKTwFVjo","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":200300,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJfkImGCRA9TVsSAnZWagAA3SYP/1TAMAbADpKdH5F0PRIk\njKpxe5kikog4puNaAt9uvWOtoSfOrbM+PW2FfO99UVsQgdsSC3tfuQfJVxRx\na1Amx5PwA0J5Tr9MRZsAC3nPjXkEwB5eUntmEUBFwiTzxfKR+oD7HV6cgvnE\nBJ2YO59xHIZsKyqRB/jlAY59YuvwpzMJU2zlrOXE3VFQhl5MXnBrSGEsrhd0\nDmvDbBSHe4VcnqLiHnMR5R0TybR4zh3CDFvqSpVqO7RfR4FSFugYGrkm2DVz\nnqaeeKd+C5Yf3D8qowJpht6/LDIjChkX34cyzjOmJOBlRVWu+VNq9qxbiH71\n91Su12KrBApUmpOMlXzc15FDG8NsYCuYoT7WuLy/0KcEDKFgEg4RTvtB7cpZ\nLK/wI44nHEqpZfXzuxlYumZEfPv/v8d6mmywLR1Zqrr8Oxj4JME13FiSUaFv\nKeaAgVvydfFmB3upG8VnRbWRFLA+2fm5RHTjWJ4FS+9lcyAENC6WaFj6A7Hr\nF+Mxl77TLGnGZEFQCHc4vjvC0obwt0CKSZqjW1ufSoS7lsQxeTkCbf00SSFp\nnutqdx3XZ+MHK+ce0ujANSUdpEhHiDb7W7AHPLYmwUHFG8kJK+BJ26139q7H\nRsAuA5/v6wnEAvBrLx2kFn/Lz/tD5EbE2rWr7gSc72b9iwNgMdLeekztbcmi\n04uK\r\n=uLJJ\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"bd9903122e10f8ea822d6ff924e3bb5d07274714","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.8","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.19.0","dependencies":{"tslib":"^2.0.3"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.2.0","mocha":"^8.2.0","eslint":"^7.11.0","rimraf":"~3.0.2","ts-node":"^9.0.0","typedoc":"^0.19.2","webpack":"^4.44.2","prettier":"~2.1.2","ts-loader":"^8.0.6","typescript":"~4.0.3","@types/bent":"^7.3.1","@types/chai":"^4.2.14","@types/node":"~14.14.1","webpack-cli":"^4.1.0","@types/debug":"^4.1.5","@types/mocha":"^8.0.3","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.0.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"~6.14.0","@typescript-eslint/parser":"~4.5.0","@typescript-eslint/eslint-plugin":"~4.5.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.0.1-master.bd99031_1603307910100_0.9972371664006241","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.0.1-master.434066d":{"name":"json-ptr","version":"2.0.1-master.434066d","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.0.1-master.434066d","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"17abda8ef2a44f7051b9ad35ab2f9c59fd89c22d","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.0.1-master.434066d.tgz","fileCount":19,"integrity":"sha512-skuKBTHgcoH/J63vid/eEBIk/TwNAY1q98Q3AefgAEUMVDOUo1k/KWrhmiW6eufOLcoBrfTFkb5RJk+nUSmPzQ==","signatures":[{"sig":"MEQCID+1vMqG1WzawqSJ4wWUp/QAjZoBkboi4yjRw9Atp6rfAiBibHItsj9KBWJV0jBrIXgpna2qzUEdzHsA7uSR1u2nUg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":218591,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmo9QCRA9TVsSAnZWagAAhBQP/jo1lSeuZnPEt042lhW2\nztfrMwY38Wt5Jaivw7jYWho2rwc3o6KS0G9RVLQO0/WsokQXV4NwpSUxhIW1\n1l+mtKxaRZCwuhaiaKSkj5g2UA4fAUhT636HuFJ5OH0jVlGxxcqTvglJdSLE\n4FjPH4Uif6yRxE9Q/SPBXPovK4VTjnPfTT2QGkTvyIZcff6+0E2RK8Fd1360\n9e6roHs4VatCth0WBBO1OPz9pNNiCovEMKbQs02AdM7JE0NBXEcYMD6kBvVk\nVDQCzaCJfxsDUJV3gK/lT80rjiA31k/z+2yjwi4TjsUEct+tfkrVeGpKLRAy\n0hntYOBUTpqzE3ByCrkiliimaocQeuyxwkExrafi+yRc0j4EXLldHTdrxFER\nlYI5OXmo0FZduu7i0ASI4c6j4eVUuwkqT7zj5ecsBNligYBeUwzLEJdr5iH7\nUr2gtWExAEa2EywXlrGP4dQBfhlCI3fczwjwfnvNfVsPmg7ezNHI6lb5Tz5e\nNSISl4Vd/5fo4zjPr8JaWGYCqM4UHZfGqXBvowcp6CUg/zCYQPq/DzaK9WgF\nm27u2I0MK3O6VMlcoYDiaAG0y+WE/sQLnKQJJUkYran1EkvXGbSvBL3KFWH9\nn/cMhKlNLLYNBZ/yHPo6WWkNLzu1siqiPypT8W5mofo28AvryKOKYpnVn02l\nXA5M\r\n=kDDr\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"434066def094313b02f86507a6bc0dca68664e0e","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.0.1-master.434066d_1620741967992_0.9349329604840619","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.0.1-issue-28-and-30.f825bd7":{"name":"json-ptr","version":"2.0.1-issue-28-and-30.f825bd7","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.0.1-issue-28-and-30.f825bd7","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"08faf2f502494c6bf8c7969d186b01f7735e577e","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.0.1-issue-28-and-30.f825bd7.tgz","fileCount":19,"integrity":"sha512-Wd98ebFPv3oqheh3PxzoRQfLAqYPKW6g1e37A9Uj5QAm+BQ/SPpmP7fR4R2CrCHUMKs/bCwQXMRRwrEbYaTcPw==","signatures":[{"sig":"MEUCIHIWvvEtc8Bks5vjUrv79dVWtx1wublfwemDCBY4WJJ/AiEA7hX6oD/VU1nI5Y5lTp5t9iCk28N7mY6wSRsvzMHi+fk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219033,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgmrR/CRA9TVsSAnZWagAAqiMP/jS6/y0KbRHfU07bJcfj\n4OJWLBxI2HvUG7e9dn7rTU6PMsRzl7rOtdcbE9EBhDciGBXYkk3hJAVJWDZI\nlBLXGiGIe8bLZ+bAqUTVZYMdKhgDGbcxDaVOOsc7GwbdzfE10q2LwUNqP/nn\nofAZ4zY0W4qFkHdKxfJn0hXds90t64hnsqbNw1jFKECJTE3+zObu1uWZ/mP0\nHSQFEbMSVMfNLHY++P8cwGF7uf1s2kvzOQ6wDC62rmftYXzHkMF1kYWgh0ra\n2hmptzebxj4NSojlElJ3cQvwRN34uInsA2JkQTLI0fXzdMKRKDw/9UgBEZR6\nUlybMM3npZWhlPSQWTQX5HVO1x2kXpUrpLA9o5zzTmZo4QSPuyeo1OOloC8m\nMoWei8xrf5KvWO2dxt5rpVuIb8EpuKR94XaPMaNu/zBFWRbfIdhDCbJjjD5f\nqHm2dVJ5aVtW1y1hFzfVK37uYr3vdA1KFhgBoqurmQcBKaedsx6qXXO0TOF1\nnsGTtDs9qgkMVtKmLryUxtDIjQiVgEIKKDZoa0CrNaSlW4mgxc5WoFZWyAOJ\nptI4OU/ehHLE8WU6PBoykHeu/Y0YmHtEM+1Mu5ZadGQcAt6NCMjeaq6PnSLU\nHWYt+05TCXjUdgojTtX14q1UOdTlhEJfDK7oueYdrt2m7rMQRvkf+/yG1anT\n5NYl\r\n=4hbT\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"f825bd760af1c4aaaf5d63e201822fff57b55683","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.0.1-issue-28-and-30.f825bd7_1620751486998_0.3612410484365527","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.0.1-master.2539e34":{"name":"json-ptr","version":"2.0.1-master.2539e34","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.0.1-master.2539e34","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"9ae7e2b85ff37b021bb787c4cc07c4eb8f0c90d1","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.0.1-master.2539e34.tgz","fileCount":19,"integrity":"sha512-S4vTG4OokdOJdn/GWtVI7wk5bzImhJ4oNQcp19cXF+FIBTQ6qtdllWf3LIMRmmmEaP17tmHH7OreASb5vbzCgg==","signatures":[{"sig":"MEQCIAcp4yHHPqOdLKXQ8KtLNtRFtMh718WSfQzjuzZrhMGMAiBXTvQgegrTN2wKL7ItxzlipklG3IZpfY8nko7wa8y+4Q==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":219024,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnAxuCRA9TVsSAnZWagAAr6IQAImIvQ0zhkMd3F5EMjT5\n47sWROj1VEAMPIEI+2mzGuf+7xYzrN5PyU8ZRvFvJxCjAPwUJBqPSpND2mrM\ncpEJM9ZND/Pc90HH/ucyTQNfUAdGyTCAcqefcWZ98yMtuvzzZYUaFyKO7L2d\nNWFKaqDgsviVSVxMSe+3D+6fAxI/BOgKPCedy5PAAbW/WxDJCPkCU3TEvodz\nmmGKN1NZ/ECncwca1B9zjfF4Al7BMI9M4yZKXgpg9lD36Ee4LAX1pyI12tUB\nDM0p5TLD2RQ68KHtuWLnoAqMAX6rncpTXaF5yvBcpfeFVVJfAIs47tQS+4+n\nd6ntkQXUp2TavJQoMI7grhHIOyTsH9swLYIlCQpCrRzAzd1ukd1Q29+D7ta0\nkD92/RLN9ecc5veLv+j5bFAnA9P+N2yqhujjhSHBDdUAAxklm7k9O5srL9H2\nIzOxQNSDvvBT43KQD08ww2CNnrGhob5jldENvqDW9UFnaZoaJ0o9g1rz5XkY\nrMs9h0LPSRmgX8RVfw2tQuTeyfVIK2RGrsDd1cWAz34bTDYfu0o3iR/pFO87\nDpDn1lHTzfXRZu6sLN/Sct1PCJYNixg/2w7ic4rvMbOa6KGN7rY0ECMjNRIv\n8K0YCynRD1Xk2bP3d816d3YvrnbzvJsdzD65m+CcC7qoAk2IeLFszBopohXY\nlaSt\r\n=ux6O\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"2539e3494c80af1eef24f0f433654a61f255f011","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.0.1-master.2539e34_1620839533942_0.0987345427523989","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.0":{"name":"json-ptr","version":"2.1.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.0","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"245b11088d284caf2e059f6eb3dc7aba46b8c54c","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.0.tgz","fileCount":19,"integrity":"sha512-dcjfEj415rJ9i/UcQ/qwrd7NJYruTJMtWwwsM7ZRjJes98kMQYZDqnSXigNe7vVHiZ1RATbR0RbihOQ5xxDYEg==","signatures":[{"sig":"MEQCIAdO2E6gbx+mspRVluXxRbMVxVqBlTYMPwPabwD4cX3mAiBeEz7g6mMl3yDOuOT1GRFA6QJCDciabOZnQrtobY2IuQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":220234,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnCEzCRA9TVsSAnZWagAA2JIP/2xJ2Jxoqq4C2Z/gfxOJ\noNz+BrEiTqalTi3KJ2DDHHrRH8Ch3EvjGotPwYIJmSMdoodB70lR+axOdPqr\naqKOKo7dG/e87i7PSwP/mUvLUOtrBqmO6RuTDnFlDsU98K0r6DsGUcPjb9DE\nAvmG9ByYQLF3OsNGwTah85Q4ONowZhPnrfKHvRjETgyJMiQln0jX8xq7HC7e\ndWMS+nPiEsWSCGEeYOzHTLdZyxysSlczJF6aEBh+ZE+rKVz+saYPeiaO3Sev\nQooLPYuMG/HbF7rFDAdlhxGKalMCEkYnGKeN5Y9CdLoYkIS8yOltJxhj6xux\nS6R4+B73XMFYokJC4J5btq2vIRPA9pYgjf6Tw7CiBQkjgODiukk8Xk6urIAf\ncTIrl9oyZO0uT9nr3geTsbv8cURODM7ER64Hllfr8uZh02kvb9QVtRLDaHoP\nF+ThQHZ8J9yP3xCATr3kzHv9Deuc0zdaVHKdIvPSRhdqo+QS9c+bX0DazDOD\npARYXCYX/DpEoTi0zwFVCCqG61nq8eyWYvb47W9kBoM7n0+4MSF5OhRge4Ne\nqFry5w5ljizGDy3ZsJU3qYGCaykWZV9t0ePRNTY4lWCYTaxaNliJ96juitwj\nmUsGKw6wdMJGlpxj/oobemlhXRQteTI5jzUz+lhOeOSKTqsL39CDqpQJ9N+7\nV2Pl\r\n=DJds\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"6efd1ec79319240de3a550aff164726405c7f98d","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.0_1620844850812_0.0335589569408008","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.1-master.6efd1ec":{"name":"json-ptr","version":"2.1.1-master.6efd1ec","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.1-master.6efd1ec","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"720e458e4f7e6cb42de9f212fa197c7df11fe997","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.1-master.6efd1ec.tgz","fileCount":19,"integrity":"sha512-QpcQoi7JE6yLGZkX/4O4duxWUOlifrO3FeTeDmxiqcZr5625Dm/bzeCljvIEqeec20OB/AhWopr9+0hpEi+Z7w==","signatures":[{"sig":"MEUCIQDOnJC3Q7WeApENbfZWPeD/q08SegCEgvR8cHf1pyHSxwIgTWUdEZT8UvM4WuS9oM+oQjO8lT2LZ52eyrYFPQ7FGCE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":220249,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnCE/CRA9TVsSAnZWagAANh0QAJ0KTEavYRBoBZI169CR\n6vJY6xhOHX5JsNVj9PrIKV0EcVesdXY29p+Cfl9q7w7EaG5RvAJEuFe6wvYf\nPi3rBXKoMGzPNSSXgoHWQCFIVMoUWegwv76Aay4ohZAelPYyACdC3c3Y2K21\njyN/+vCG9zn5yQKnU83xKdkU+VL2Z88NIzCy9mhor1wkNFpE8zj5OWkr1NHh\nxxYnULiBTss05gjfXo6ATTCbk9+NTqyz1cM1KWeOKC4xpomX8HeHsdZo9edW\n6kXsSpzVfSiOrhyuFVikLkayPZPRzj1fGpUEPnvqi36PuJUDukS5yWSos41t\n/b/YayvuekeqL4BRZ3/K1HCGmRZLTYMzBM6Ea/eUSqMZ9PyxXRq80Yb9r/So\nYGVRnxM5XS3/rJxyiXMFZpGjMBxuSdvvaUgTYC6XyhXYJgbAjxZUYCJzAa2c\nctA+uiR9pf42Kw11kUL5fltJS+Y8auhI3V4ZnZJSkWou1EatGT/e2WqUbZod\nQG7zx4ncHG+wjA34rOkWm4efHLUz8gn+5CgZQNbJL+T3sZWa7y73E9PBtM3g\n3ZBcA2lJ6r9jORks05cHmVoTPIjFLmpL0W1QMBOG89bjbwQGFIUMcvIvf/un\nG/6i6sJ/RF05f3n0mWQRiXkSW1aPnpKXB3cPzyk5qtl3UAZfa8T8he2WNqAP\nziQe\r\n=B/hu\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-12 — **2.1.0** _Bug fixes for #28 and #30; **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"6efd1ec79319240de3a550aff164726405c7f98d","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.1-master.6efd1ec_1620844863301_0.7111967053354209","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.1-issue-36.f2a3959":{"name":"json-ptr","version":"2.1.1-issue-36.f2a3959","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.1-issue-36.f2a3959","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"f75843a22ad7b808b2a245e179e86018be586f0d","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.1-issue-36.f2a3959.tgz","fileCount":19,"integrity":"sha512-dY+Ttkxb+9r6og0C0+qR4Lj9cmLAylrbRB+LzFoTHqXIKY9nFCqL/TdkC0SPLQOlAS2SCh5yvf0+4R7jKHlVDw==","signatures":[{"sig":"MEUCIGZiVAD+BiUCdYI92HeytlzV2xqvyhA8zKl5/x2TYw8bAiEA1RjxisqFZetOru86n1uKzPNeACNRercwIH/oPahb+Kw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":220619,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnDUHCRA9TVsSAnZWagAAma8QAKRLz1oGmKt8tYggA6EH\ne/SGOenW04AOMlzhvreyu8UQq5/vZFic+qzx+dPQa4mHvWLIuxKBZvox9vlO\n3DsVxan0KLOjte4VSZaKfXbZf9Fd00PWa5hKiygehN688VCmfeHlGV9AcCL3\ncFp0ktPeZi/WaMrGVBdR1OoUKZdKRCDIQVTR+UozOMOK6rO8R0jlHRlkaVFi\n9nY6/phz6sMxU7JefuQvZhCVuF5Z7gUpmcBh4vnojJCI4flURIvPEo+p8bke\nqPihhkdyQKuo53UGYqfTfEZAAY+VsJ3CDM6exzmjIJOQ6500gG5XfTtKtHHO\nn7z/gIWaE9pg3aMhZvICRZTCv3ayDMxUhYK6rdtMJosehBp3wRbGad03kPgs\nvKRceXWwcyib4EPymLuJAI3tu2uDhGHVfuqq3TmpdAMluAvNJGmGK+sokh8f\necpX4QA8jnp9wGfpQQOL1LySsEr7aluHqiTqa/OOLZdaRATKdCcIV6qHTeS+\nUDGvgCRXkVUGnPVxDsSouRUZBx2zmTkn6F0A8hIkFW7xofrE1CcLOEXNQOS4\n1wxxwzUbkXMFKKx3OxpEGoQdYyRDx/GhYB+9zZdZCSFnnZkIwsnTAKFHN9e2\ntE7LI4Af5fzNNX9YhEFarkcdkzc9mj4KTpcEENZU0NuJGu+9h8hZXlJWKj71\nU11u\r\n=rAp5\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-12 — **2.1.0** _Bug fixes for #28 and #30; **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"f2a3959cfe3673ee8fdab6ae6524ee64b481ea40","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.1-issue-36.f2a3959_1620849926762_0.051893439150133336","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.1-master.98922c7":{"name":"json-ptr","version":"2.1.1-master.98922c7","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.1-master.98922c7","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"7dd350e8167634c69586232ab5bf63dbd0d49a0b","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.1-master.98922c7.tgz","fileCount":19,"integrity":"sha512-ZAxfAB/oyIzS+QxAHtuKDo+dHTUlTEC9dlhNz4ZVd1lDpj3PGummKCi2ZuvhBvlSZQDG1Mq0Y0ijZ0aiCMnQIA==","signatures":[{"sig":"MEQCIFYC3dPbCWH0kaF444JsoNyHijpH4tik/DgOSoT1wQEQAiBqNL+xENQAVLEJwnoFD3hCPqpWuz4KDlS+MIxkttPveA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":220617,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnDYNCRA9TVsSAnZWagAAfg4P/iJyvuckYyG1BiZIiVQB\nQKfLgrHRaDYqcKiP+F8exwxG5tZIYR2h4MKHPMLr18wU8KTSm6EXKNZYZMT/\nI7uKAAwnJskXbPD1GuLHxMLuXAXj3xb4QagraBacpxUPl3lpBqxgf59llqGU\nzPR9zyNn+eEhEq5iwFpKkK1YnQ37AtksK+UsoI2Afx71TzdRUV0vZ46FeVMg\nkTozub2LGdX8h0QS+CTRTNv8d6lWS0jvOWInYM/1xMabHBR7ohhMWp/g7d+N\nFc+URO2s1O3ONRa0X8/dHyGwJcw8pFTE4b4JE9Zc6wg21U9AUfDBdHkVhP7z\nJMUZurD+6LHNRVhDUSvzbuhmNHqXG0rl3USj5/mXpqBgPfSyQUU53C6vAQme\n96tOf53ZYPKsDyp60iHrQkZzV1igNDAVhg3flrd6xrDCWL7GRkEDtlcXMFc7\n+I+27TB4DrV2LyReAOo6YjtGEX/SrtKrWuQ6RHIDPq5GvB4rBs61XX0bQFSV\n9198hIWNpVAqQPTbkn00fJXs+coOSOXJLyHiMZPnOybzPjeoL2gnC5LnrUrm\n99MeWnp6sRBI0cthTY7wbAJguyVSLwOhIrfmSjLGmqaApjkOCLZ9qnulOKFA\njusDypRcTcGxkqyR9eTaMwdrdhoZ7kcYQ039bM2uQmZPnpJjfwANq337CQ+p\nhT+L\r\n=5KcA\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-12 — **2.1.0** _Bug fixes for #28 and #30; **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"98922c7158cbeee1c98495ad4bc1d6433f6341e5","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.1-master.98922c7_1620850188693_0.8018101854639288","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.2-master.bdd6317":{"name":"json-ptr","version":"2.1.2-master.bdd6317","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.2-master.bdd6317","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"1ee18472a96667b73b90053b06f757f6b1fc0344","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.2-master.bdd6317.tgz","fileCount":19,"integrity":"sha512-hmF7cDYa3BWgw3f3adBD/He6mNqgZ5pB/8HaJhX/oiqKCxsCR/sZeIk3MWdI+44GLVB3dKu8LkL0ckv6FyGyYA==","signatures":[{"sig":"MEUCIQDuweXiuNLNFNdlkU0qpD72tfrE1j/B8EF8d+YcQYMYEgIgaJufOYDb3axf1469+8GnJZ2ul09rvad3KOeLgFcdRAg=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":221107,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnDj/CRA9TVsSAnZWagAAAaoQAIGgG5BXhhi8I8j9XYFp\nwpXEuGWFOElb0jRm6p644TgS1do+eOV6zoz2l3jTiw8pjzzJ7vsNksrVXqVA\n7Ee/NiWh+SqnvyVrH/pD3eH5o72ekCX6EbDwgKzpoiew53pCO7Cz5I51uV0t\noGkSEX9deMShzx2HD7DmrIzRgj4U2mI4r0qVzIDMhwKaMyu7yOckyB/eZhOg\nTaUflWzaUmjdCiwtpzuTLU8n86ZO15XNy4mo4rQVAUt0Si1XdeHqqv73+vMq\nzGGHFDEtyuBDrdBRIad8AUDhLoA6Pr1li8Ug8vwt7SLx1ehT1+C9OmJJbLqd\niYP8a8NLOyu74pjFxMylaRkIRAoDNKbA/1NzGmxmXXGnwhVWY/S5EgN/PcvI\nUEZ9KraDUmTAoBBByS4+a6AkzjIUpMu6EwaBg9m+tEdTsv9e2AX7yhFd74Dk\npgAvJjpfu9qbF8SpVsU+bdzNs7bCYrct4EMRaJ6UMSbjs3mHVd6kbPhDReCf\n05B5uMMfSqRMgLn334bIeqGRqbXfZ3aVJCcQc9cUDIx+wcIczE1ML1HYR7Wt\nj+dTeRxj3ffCo4RofXhiVvjNyV7dPNn5IfLmG2OAsXoYKg+ZHHTh/7x2ZfFy\nX4kkt2kmLXYFnHpIs5KXGBvNFMrZsQ2YD6l0gkpkm91NHvr0phQp0CyM6djU\nLnLZ\r\n=ggkP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"bdd63172d8c391a68fbf19337d2f2efc31f15503","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.2-master.bdd6317_1620850942770_0.8760006653781638","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.1":{"name":"json-ptr","version":"2.1.1","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.1","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"66b8ecfa237289e18ab630a572a5891e66be4466","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.1.tgz","fileCount":19,"integrity":"sha512-64/64Ten1yBVw8vVjnK6DrcBlM6uHOPqw0dLzAjcGw1qq7szKVf1azj66bkNaH20j+7X/K/pN/wuQq+VPnKB/Q==","signatures":[{"sig":"MEYCIQC92LUzfICKqjbNQSCCkvOWj2YaxVtCxdHITluodzzeNQIhAO52C9furwhh6FHXTwnb5gQ9iKug76up8Ldgg1Juvl/j","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":221092,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnDkJCRA9TVsSAnZWagAA09MP/1zKQkPLbAIYwAHfjxPL\nP/7JMAomv4V4avkAv1eiNL52e1Tfba1kCJtLStHwDQ+NbtFGSF24e9MSZ0Q9\nnpieqkU1HbPKL42hO92qsulteeiDy78PKtDDQIM50v7dwusKRD9/A2y6fdrX\ntkuBkQjCMR7h0C4G25wrKxQPbOMTSIYudD3zDVcPYs3dMIis2L4DjfnsfxUi\npzxdYh86IRKAvDA48WCxL+jK9uJ97smS6WCtPZs3/IEgH3/YsugzkJQl8Y7q\nivaurh7xPNIF5sd0jF57xGSxa/AlOW725XxLsugaazDGYKf24McYKZs0Ahen\nUk2ossc8c8zByb7jvgDqf/l8TFZoSo/hTY5Gilyze+fKzFYUzM2tQ9xUkFNY\nvuJnshSAru5KloJFg+8TKQ34IGT6kqvT9bhGkAY7u5v9K5ZcBTdPLH0JSteo\nW/5MHJNsuSwfJ/YX9oj/lebDz9fz0mRXgX9YDmDS2CBpB4+tPC9mKf24p6Ro\n/PTSs8QPt0LEnNMsG0JXgFi1wnKQZDzysck1tOSLMl6vuasYUOWiiJsiWgs9\nINKUwmGHdLcYHOTJlmRyCKPn+aw1NU2/Ck0twqLnON4PqFQCM+YjOx2ZY+yn\nF7pSHaDE3YYZ56Vf06RWjwGOVijVhLzqeiUV7vNVADDbETbrHSwp8It25LyS\n/ekG\r\n=yzt1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"bdd63172d8c391a68fbf19337d2f2efc31f15503","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.1_1620850953075_0.7660502714080657","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.2-relative.2485c9e":{"name":"json-ptr","version":"2.1.2-relative.2485c9e","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.2-relative.2485c9e","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"0cda535cf53aa389dbad0a9ee08da09068ccc888","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.2-relative.2485c9e.tgz","fileCount":19,"integrity":"sha512-sffwaHziTb2y/Y+fL6RlzfXZw/Q9r11qzTndK8l5QIpngFyIGsTAqMHk2JMd9vS8OBiNaYNSdO11p09T+c3Vnw==","signatures":[{"sig":"MEQCICSA1mwMkC8B1v/nDbC0kckygzygl849dmTHMMw16/yAAiBGgSAQx6ZPSl2eq0o54EF/Bi7HHAZ+sBoE2TfUxUWdcg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":229023,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnYk3CRA9TVsSAnZWagAArKYP/RA4JQ3kD+puRdJmzBRj\nwgBCY0M4ui5wT2Wkt0gzjExw+M+TmLef/yIMywmc4E0BxZdJP9JYAI9acwTl\nBDYdqPCuHRg3Wz9s7ULvdCR+tlgrPYpLJkczZECYnUvpp1nh3KCgygPOy41z\nVGJ6gUjpLQdPKZ0LIy8OLqVupkls1XNQWcLB0ntelGwvryL6jm31s2kr6AX3\nLAvNKhZQ5tpvN6Trdko7xaHLTK3Xux3QKCLZF2zCd8/Iw0DxjVTspY593em+\nMItrqtRrG13DpOvjestw1jJc2xrj7X40LJKMfQ5IGkb2PRHcS9QTZjfaw+rN\nfzWbkXDXAfythZdSmG/aoBZGYtv3JnFvNc6f/xW1heVayqGnXy7J9eirZOSx\n5HB+z5Tok8twYipBwAwzJuvF+kVokUAps/JFyCCipb2OQF9rFvBVPMYUwcaK\nNtm/teBhg00kqu+9iVixK79XAq7+8GmkFBylXNKmUgB8LUkvswzFkjA81uZg\nNgfl+q+02jp1NKJFEu105vMdlNUiQ9M4Hpv0q1DG9hoCHAeBoQhYRZk7LNM3\ns0+7hjPHX7EI8LSpYfaFncRmi+CqpvH7qI7GbTUx/y+a3dN/Y/ZauMhD3NsC\nNSUTY70nDF3dLzBGSVd5QGUOfRtmJcuTQ8Bqh19alqHDwfUBCR0yASxqld1Q\nRpxz\r\n=eBwK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"2485c9e18198485d1f3c854cb8af090bd8425d8b","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint:fix","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.2-relative.2485c9e_1620937015296_0.4969958780756163","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.2-relative.ab59597":{"name":"json-ptr","version":"2.1.2-relative.ab59597","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.2-relative.ab59597","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"64192eacda8cf92ff14d56c557b37d4713ca0a8e","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.2-relative.ab59597.tgz","fileCount":19,"integrity":"sha512-wNwa78l8+IGjtjkjzExljWKe9IpMZfQTj5HxE8jIEhsDK7vLhOxG9e9qoxhqKaKWhfsGyE1fu+mexbwiEClg1w==","signatures":[{"sig":"MEQCIDxqGfWFykJIkq+oyguW1u6nAGouk78Px3MjQ7TEbZryAiAvAfPDP6VNehxLajiGBuj/X6F32dEHQsfbqtA3KYXZBg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":228929,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnZGxCRA9TVsSAnZWagAA/aQQAKDZOP9V15kLcnBHCpCr\nt39c5AGIJ+EDOCzoBMF7hTf1cq/N00XlR16dHnfZev25nwIh4vWXMp04/5Xf\nlI7BtKY2cmiSD5HrnJrsSn4ra5ua91bUdk01Lpu0rzAW5Ji99j9K/ExF1z2m\nGzWmDgXHCBiRWh9Y5qVGwYkoubaukG+xhl/VYSYXgKQrIcdmxPugv94x6pio\nSGUGASxpiqyO32kmc5kZdsPsYuQVYbBXFkCSZlNegJwDG4eCaKMP9xyxyhxE\nNo0bX1QZ2w8QqPSJ0v4eLPrkUqAzPIFz+1Y7JiD8az4Yyk1X5mXeLfVQM7Pm\nmhHcwuzyQ2rBRzXLidUtRrJZ7TmTrMNWpIQQGilhHD2HDvLsYeEF6Fmgj4PK\npcIm3NvndbpaI3CB7M+CM/VWtvcpmcFfpKLAketbsMFBkJNNE8yXtYpnnEpe\nFNcRtuidw8nO82rgm4lE9pY293EJ6nst+WPlENFcycTT2qGdJ3QCTXAoZJZa\ncSMlBQT12HdSsuu7IasVTFhhYVP2qQnQBNlRwjBT9aWFHvBL4gIZ0/Ff2DLz\nQLDYNbBETsa/jg0BNv4mgi2czIGE2EEs4BFfBW0j25XTshWW4k271g/32c5b\nA+qM5Ymmd/QBn3kGMVXxE7O6OOxfoAqNOoY6XAh8CF3Zt+pAmvgQmf+0GdIY\nm97z\r\n=Hino\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"ab59597ca403be35fbb83a71282606b60883df49","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint:fix","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.2-relative.ab59597_1620939185100_0.6494228411999383","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.2":{"name":"json-ptr","version":"2.1.2","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.2","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"174f69b2bc7777efd545cbc95447af790bd47bb5","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.2.tgz","fileCount":19,"integrity":"sha512-MR8zOcNNUtSXjbAkZVAxSsvnY6kVtDIT/DlWBu5u6prj/vcDtbUSpLwSQmVCBSx/YzVePJWpFnTkTKe57CpoxQ==","signatures":[{"sig":"MEQCIBle1/n4f5P0hzjnR7mPMJnFv0Ulr8OgC9yb+DqvGQASAiARsbR5BlXbAkaZp4iIsAAv+e8eZqdPkgrfIxPszJ3nng==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":220998,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnZITCRA9TVsSAnZWagAAkZYP/RWhxOjLkdKap07jSSj8\n5U/GDJiZgyFY3BPjaj9qU5SzDHPEdEaZWnELmzQb/2PFEsrMlD8/rqESS+1K\nWJbyhJZadbuG0qOQENhlirUPcr4VyjWx85QWvQPjMDK6ht9YmUWZAM3GBsMV\nMTgC/jsYVcckglzoZkJP7+3rcs5Io1yyInbvVyUyV7jwayZIfYKUREfpf2bQ\nPhlg/cvK5rKkdZUtlB+kkgqYqoBU2SC0yHhrHlZWRYTgtwUNKA0ki4v5j0xu\n1sE1yulIPC2ItVSIGn6NyJBQtm+RL60xhM6VeQk6WmHP6C9+nIs5ypfL8IQO\naPoex8Sa96aYu2oQ7+l34LddSnXK2fJkIlMCCr2PDomjuzmN4+cmOLxt4ctG\n27cdV4SdR5gWA9tw8DtzD1tz/FcgNP1hkL6/YiF1OZK0c6X+xQ/ekktKcvvG\nKfZ6ygVQ5c2CpyjGXsqc0z2u+S3bapPHgWPEXPsA0pM8N/B+n1r8AQUWoi/w\nOgqZUiORk7yaJk/KqCj+EMba3j+YBKwcKh8J1v4Bttz+Y/BmBCJGp8CqbQV7\n0cPBiGTOz6mRbQq9xj2TdIko5VYG5q2ID8wWamrqLI/Hj9n1DCV6vcGEjNGn\nZfA52AhqHN5WSkX8GtlZzNszmowPYQH8qPpMvNb0kS/ARy13m7lZK8oLe23z\njOiZ\r\n=MNBP\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"51308ff812c117aa05c8b86b6e343494ae7c2de3","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.2_1620939283391_0.9735422103480922","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.3-master.51308ff":{"name":"json-ptr","version":"2.1.3-master.51308ff","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.3-master.51308ff","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"4b64141ed4d6595d346a80ddb0f65117e5574be7","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.3-master.51308ff.tgz","fileCount":19,"integrity":"sha512-kLNjOw+sS2FoiXXLGBnpqGj+Q0MhCgyRII3uuvsRiAmyEr+0jrNgwncDmFucxg9YsBU1vnWMhIRnvkXrFElXDw==","signatures":[{"sig":"MEUCIQDbN43q9FQMcf7zMesfYp1Y22GMwb39HkLMhoyn0uPB0wIgB6FVoBw8+CgATQ+l+bYUXT8bV9WaBJmHjB24jTedIPE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":221013,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnZIoCRA9TVsSAnZWagAAxuoQAJv0TheIh5IzhT0fyCGM\niwRXEyjD7AbX643nZ1M2tpU/JqVjuf+k+gpvsQGcVt4xso33OFQJRKnsf1Si\nV+A4iiqrFBKSIZyq/X0XV0jru1NrKiLwewLAv/DNeklVfb/EF1m0QC0wP2y9\nZmp4e9r57DKNmDx+00f0nFIqfEPLPeZ/IcrmzDVcKsfb9VRntyV781EoRKlP\nO3zgiFmT9TxN56kEANi68SpjyJX5bEhOe9jlt5/nh9qyNxKLmwlPJhQZmqCP\nys2gleLwpW/VUOve/cNse0bPyPOZeSZ8Nhg+FANp62YXXC1y0gXXi5R3mbms\nb1u2un39YMZFEKovDDiLrMK1oSWFukkZBnVUeoYRlcePc9s3ftkSeE2azyFB\n8tohzDUzaHxYq26sYEyLlXxpXp6oRAZb9/X1FFoqpLXrGW2QsT3Mfx0fgiIt\noZV2oshmO1Tdp1y7ki4V4lndVL4LvxbnXe0wAYK3x/B8c1ZbpiHwRNAwVUii\nzy6gJVkIgSq3scSZ+UNpctudVj4cl1OHBpZbqKDtDCWulOs0sA9RkAQQqEpH\nOJAIcH7TpRkWyzoibfMaEJeX8X1INtR8r04+G4kEyZtsm7tCxU6II674Ppd1\nXS3icilv53vCmggeNUSe5nHVCbKKzvSU0HVGzgKSbNggPq2nLX1SSf2tcRp6\nIrLF\r\n=s09C\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"51308ff812c117aa05c8b86b6e343494ae7c2de3","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.3-master.51308ff_1620939303949_0.3607782660548813","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.2-relative.03b7b06":{"name":"json-ptr","version":"2.1.2-relative.03b7b06","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.2-relative.03b7b06","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"ff19278063e2df9fa112c0f640d48509e8e0b282","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.2-relative.03b7b06.tgz","fileCount":19,"integrity":"sha512-DfRP4/HfS2ObtVtvdZIaHeuIJdrk/K0UHTjhDiP2haz1xoNi3XzHLghsAy+/WIrhr1h0BVGZryS73rKKu5zY1Q==","signatures":[{"sig":"MEUCIE7wgnMAcr1Nj4klobbyb85brmciE+HYrz2XoFSZb11HAiEA8xRHg04X2951eSGmA1da3zEhjdec1Ayrc8G50WfL/Us=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":231273,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnZo5CRA9TVsSAnZWagAAg5QP+gKhsJxEudijoxT0lx3N\nmWnmNZFs+WgX11ERSYv3+xjoGOx+oMhh+VDgMtYJsM9dV7UIr5eB2qgmr8Gp\nOsdXbmqseqF0N/axN8UiutEXZKVhvd1yIkr5DGbvQEfg4/CfW4s4tcBPA/MN\nenH7pDuSqGUbfQozOM7QoR/OMTDH25tD0tNczJsJnqac3w6TDl7BzYMLs8KW\nJb1q81DQOxZ+C7VNXtZ+31saYokDaqfHn7fdD/9469yUI+8bODJuwwv7cMdQ\n4NTf6YAMG/BtjJ4IQ5HMOes37tkBcHaSjlVKx6XqOJQwON///klqzbcu10FJ\nwen0DZOeOR3ikQL6vJwr5qfXVbisH0ajiIguhwnMpO0VWO/dkgynULP2ITra\nSyNau4FvpcFJz2vHpcPQ18ov5QCDpN3rjeVqQchAYebxOo/u/AuDaZsCIYMQ\nhN4EawX8wy6lh8xO55nF0PS4Dd4XNnfiTYzji97jFWLNRb/rgGQcmR4vVKnn\nvUpgrsn844nAn0mp0gmYGIp7Qrv3bfY7l04JZtzbOSf8RFhsscGBQZPKcc+6\nW4VJkd/s0skCW1LoMft/cFS9Dsz+nNk9Yn2/UmYVKjdLm12/dpXubfSwuE3T\nppj4LkK1AFiRsIXs01LG6GhMKDiGezZGI/dhdSoouQ03p2CcsmO50FJcnJAC\nWIqj\r\n=nGhi\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"03b7b06a57ccb7fa6778066d1e2644b0345c35b3","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint:fix","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.2-relative.03b7b06_1620941369059_0.2059999385030915","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.2-relative.3103314":{"name":"json-ptr","version":"2.1.2-relative.3103314","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.2-relative.3103314","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"f51bb7a17d9eb451171dda6ba20a195a0b1b3ca0","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.2-relative.3103314.tgz","fileCount":19,"integrity":"sha512-E7iv2bsDnEBiP+dY7HsWrmEB8Pwrln09Hwb5Ae9ZUVyWFY3kUPpAe6uuZH4N49n5uq8aowWnNIHlIBQDqAwsBg==","signatures":[{"sig":"MEUCIFbG1P+nzty54IUQs2V6vdPdCOXc/gktn/dzw1RB57rRAiEAvlZ81gfnB7lctphFwHM4v+TCKSThFshJ/QIZJCP4kqU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":233356,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnmTICRA9TVsSAnZWagAAbGcP/2vGAhDyal701iXxwRE6\nPm2ENe6xPG/vGMxuP4YfupG12UwkO2a2SgXtJp7wb4imD0t+63oxrLlZxOi5\n8mgC+QCwi4mWSAa7gTrDtDSsZR1JKGVTVroCQ9vJAM3Pf8ruYEVyQSzsfTgz\nbmKT0PEGHuaTy86ccn9j3kl0AhRWtVzBb0O1S+dT8MOpjtsO/t6ybIHFzudu\nOI1OQpfv44diOMNXNQw2IZWbjCZT1wzA6khneU4wJ8PkZ/ARLWfn7RcamTdv\nenm8mHICab5MjoSH3JD+txJDM8dIjTmtDmD51dTEDGVd7t439SMKmZgwyzXF\nt9mvCwv9JK6/1T0BpZp5qfBINpT9kHAnLXbj5/xbXigoYGkqHg4LnLvQ/5JU\n6uc17kceYEwUIpfbxubjo2y4Biaei6T1KWFNN2n89nsMy5H1QKEzdafcN3j+\nMUtCvLAnItvtccMCxPqXuBltmIT99vfmhO7025PhWM5lzkCK+ara3l4nU8Vq\nsdB0kqzSfMKsO8f46VC5EcNnpKzZw6Czm/h7KWgE+cfGVh/ekzGtoyNrpPez\nKO8uvMlaOCunst1gpAyte5ztgdI3dWdqCAl4P+JRtyBmJWwdtp0160Yz3cyB\nSFHbAyDfSHolKFUoS9pM149vnMDTTH+KEUb9wnn46Hmx8/Y5l+4nf9UWHZH1\n9Ozu\r\n=ZguL\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer, create } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"3103314d29b331af4716ddc7a50fd6d1e2a5d097","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint:fix","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.2-relative.3103314_1620993223862_0.05699447203259966","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.2-relative.f48c5e7":{"name":"json-ptr","version":"2.1.2-relative.f48c5e7","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.2-relative.f48c5e7","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"3bf8811bfb21072aec951b01f97e3ab63615b9c7","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.2-relative.f48c5e7.tgz","fileCount":19,"integrity":"sha512-xDJd9kqUMDyfxjR5SpBdi62SQBCHSV6/gqFjBoNJoJ3G8aF1nWexUswqCgaeR5wGcNeItzuEg7CSBvSxUGPVTQ==","signatures":[{"sig":"MEUCIQDiJSd5WDK2WT65LmNlAf/BR9Q0JxWY+5SeZpMePXZmFAIgDit4PwQwTvf3BFS+W6EDkloArU5d1HxFp70dsFLWuSI=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":233454,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnm3RCRA9TVsSAnZWagAAo6AP/1ycZ0xuiy1vO6eTWBxd\nA7X6sixYmsbkRkw1FK8MrJko1U0q8YH94NKUHPvKaSfteFdtM2NOzOJoXGPy\nmtCNsTIE2VznNpYAjGGlXuSIwQ4UKH7gqXGICL3+DJSqdK46gwzbg6XBYGKS\nlYVcp3ieXdsziOhHnDX8kffHaWSE1gnc0gjiyjH107HR6/bXZWZiIgNafdXS\nezCXcFSNyrI8YDU34CHdUNCg/JxRzJiMne8X5Yj1n7fqSeRaznTNDVQnem18\nLWSxrsqQ5ts4sRT0Z23KEn3M44xE0qVtUgfEsZE++iLRQnd4Se9QHecvpUmo\nz0O6yrayN0CFzV7Pgqi+G9B9E+e/a0iLgPyDdXo3HGLtL9cMsDN4h8G/rNZF\njgvOtzMvgAkZ2RHFTf6Lkuhmp8bSlJG3gLg07330Bgy4lzKtirLWMXcVPYzY\nl6pGbCmjY2ICcznesXyVkPafqh8uvncCyKCB/Gk9w5YZONJg5dPW143YG815\n2iER36a5uqlB3juQmndv4zUwaUxNpbglDJrK2lRv8FfNMb4PdUI7XWA/UVW+\ndNxQYAnpKJY4YYixriTFQGrg0UsoBwJI6IFC3WNIpdzaa1QDo8Lvq9ubDYPI\nxBgD9/Qhft24d1GdJyFI3AYd6zZCp6QDzdC3FS/hLPhP7sYLFggbfaEYMJXP\nScTx\r\n=0ac+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/master/examples/relative.ts)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"f48c5e77659efeb34fc625fd26042c9e92145104","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint:fix","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.2-relative.f48c5e7_1620995537403_0.31131800478811544","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.3-master.4871821":{"name":"json-ptr","version":"2.1.3-master.4871821","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.3-master.4871821","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"d59ebf56871248dc455fd8dd432dba9b72005cf3","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.3-master.4871821.tgz","fileCount":19,"integrity":"sha512-xOcNHk1plumQye1qsISwTuCMRV2ohmxMrsCnsADG4qjrnZY5qcqWlU6JZfKzMIK5TW9OMl967pJV8IDwW/Gjyw==","signatures":[{"sig":"MEUCIGj0IjNdxPhveBDSDeZNIV9suBo3y1tT6yyYzwzwG2QoAiEAo+D+JgVEUT0qFrg5OP21kDzngeRDAWqLZTinJhsh9NA=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":233452,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnm8xCRA9TVsSAnZWagAAxqoQAIL2MDapflzLqmcm3k0a\nuJiwtfpEz6pQAIXIS0Cg4OWOq+92sbujKXErgj0a2Vh5Npozpg3ovCc32RHr\nEzRpyylFG7qhGXEeLNvXTfRPCzyYcmKHmZsu3HT5/R4JF/Ed8SWz0pXkyn0/\nownenZSN81tZaRnfN+ICwMGWNrj+zOEPLJGJy10RNIK3DHw1esTMt14T2ETd\nNpS/jq7u0q+N6164yGKOADZgKVz0SCxNAPCuQ4iwhH+KIr4IJDm4zpmoPXm7\nK1UdABKELgtBoX7z9aj3Z2k1OC09Qwnwbc8QA0w9/iHs0LZix0SSIL/T6CIe\njtOUjpnepNaBS2fR8U49eqqmNHHo/fMgDih0CZGKuel2WceqeyEHSt41oxh5\niN1o4Vj+tVXaFeyYfrm9qAewtkBY9dqE29HbvIf/CabWoNs9XqkkGKAJ3K/z\nGl+DdEoP62KMXIRBd9FMysKrTMO4batIWyheo36TQ0kBVfY/Zwr6dPLt1bJK\nQBTdHEi+3LtzksegG/s6mWumWZLD9TuWQqsgFvwRAi4mMCT4ObQ7RXXcXmHu\nj19XGfdtk2QWCKh5rbOue+z0OQAjk3XygZKS4Ogkl9PG/fGG9YdJHleecgrz\nUqH0U+uey2Ok2P0/j5fd5Q8DkB9e/1Csb/Vq2NeOeQKE/hOkAj27mW4vsBcS\nEqmQ\r\n=p356\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/master/examples/relative.ts)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"487182100a08f4ddc7713e42ec063bbd5ce2c34c","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint:fix","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.3-master.4871821_1620995889308_0.24201938394707923","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.1.3-master.eaf24e6":{"name":"json-ptr","version":"2.1.3-master.eaf24e6","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.1.3-master.eaf24e6","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"eaf305d6a8b8df4b799e27ae3c56b7b2624a1964","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.1.3-master.eaf24e6.tgz","fileCount":19,"integrity":"sha512-5tkeRhObTxe2MJNyV/uPx9iYrILdE894mYMhm5GAO9wZRKq4k9tJet0I0L9xNR6sc/Io7Mt2w5t5HOm+nNEYSg==","signatures":[{"sig":"MEYCIQD1ChErQTFX+C2/myFf7urdk3aybz0ngXH754o+ckVHOgIhAPtqlQdcP2OFBcMRGJs7eoneLRSSIccg2VncdIGPDZ34","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":233486,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnm/VCRA9TVsSAnZWagAAQl4P/0kOCYbpQQhmArCnKS40\nmaCutOg2JkpzVCIi7QMO5uEDBHZKAoxdEc6beD34Ve3wd1j7VRrT1xlLY2ni\nXmL0mmHzvnnPQK6fL6hU12GOLshTvRER1qpnzJMCiAIk0zwlLLEpSf36TEHH\nF8fJT04/f5ZemP0o6l5LOWkXNIcIZTc2UaRzj0MzH2zBamgkmiCly81fj5/a\nriA+cfiL5ANb0gG2+ubavPpUDz9dfqWSy1r+PF3kCeBQenwy/IcuHnxM6w8w\nJOKeo27vcrx3PrrelXAXU9a+egB77n6BkOKRNaNGH1cV8H+ceaKClNss5l0X\nV1sDgkh/5oReh+ylDmCumUgP3H/6rpEgMp23NvfoajR7hKFEvbY+CIfBKd8J\nSiriGLc7lvb1zfzFPdN5RD3WwwqtOBReABrh05DnXPP5Vfe8QmYkbBtepnLR\nOKHsyA2oPLxC0ho440UnDyBjvM/WBLaF4q1IzSmFXWrRNIdzaiO8CKM+HB5X\nnhYAnu/AiFzPdddYXtz8aFF+B3f8wHDG0pO46cFS15XwrmyhPiAzb26mJca6\ntScKcOu7wCQbfeO0qIfLtZIh1BZiDZ4RCQNWFgzPXFCWKRTEBSgYdE4INYVT\nq51XaBjkSPVEqtxDBZ7sbhMM8RQ4xfjFWqQgfYcf2J4wyGE+DmUckk7e925w\n50y4\r\n=8+u6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"eaf24e60fe3405ef0100fbd895118cc531a5794b","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint:fix","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.1.3-master.eaf24e6_1620996052786_0.13786414583175377","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.2.0":{"name":"json-ptr","version":"2.2.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.2.0","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"a4de4ed638cb23ae4cd4b51f8bf972a1c2293f1e","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.2.0.tgz","fileCount":19,"integrity":"sha512-w9f6/zhz4kykltXMG7MLJWMajxiPj0q+uzQPR1cggNAE/sXoq/C5vjUb/7QNcC3rJsVIIKy37ALTXy1O+3c8QQ==","signatures":[{"sig":"MEYCIQDgUPYrlGWEzIVqZfpKI1LZuVL+uvcT6oaFZi9RTGj8eQIhAKuzdP6umkyk1O9pnSmFxDXY3pYAf+87xxoIBdECrFS3","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":233471,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnnBLCRA9TVsSAnZWagAARJ0P/35vx+gZH4QEl522eMlD\nkTeRDxiQW2SuG7TpfQskZd5e0g4YRNfFJ7Gl3QOkpcQ1sR9OWoUiEAMlWjFv\nPgPHpg2dWHRf8bHaZsA8yIRRyo17pzxABKtW3wFx9agQllANyn7o4qABcBqE\nPjAwAUKq653B5J9ccE1FyM2Pi1vDHFO+QUEjAlxPiNZNrgBug0hfTX3HNLKC\n8Qca+p3GgfdgrNT3RYi89Vs0P+9mRQffCwv7uYal7lefLU/MLxIhZN8y8yVd\nUOR0zINZ8OyyCap3+X6p6cAsA/OSiJCetLRYb9o8fG/KGQi6b0VR/CQ1aSi9\nypLU6K4CJpLHUK3T2+fD3yCEImJyoGW4q7tOQduKIgdpQwCaWY7uHu9V8uQ8\nYkhxL1Jy0IuLVdPHotGli/5VlYdtBk196pM9LLd+8R78Ht7h6vtCd5+zZj5G\nRswLKGHMjs8G4PXBt10t1vc+VbKtTwVRgyifN9z+IutbMlrjQAyc/wXVtsb0\nk7Pic4c3yAa3tncky2Yq2wYt/Ncrw5rMTMGS1priHkSSA5e1VcUDszQzCMeL\nbY3ZYb0WKaMkQ8vkjFRxLQZLYk98bvgVMPo1LMbJMaYPt/Uvkao9jC/ZDIm3\n84pzREgwf3Zs9lwyKUXzT/urw690XPadOn/ZG4yWF6GvvAtvwpAVg1TR7+by\nfte6\r\n=JDii\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"4ed0dd19f9731de8ce3d7b983c341a22c7768b33","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint:fix","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.2.0_1620996171308_0.3310442734947523","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.2.1-master.0c06aa1":{"name":"json-ptr","version":"2.2.1-master.0c06aa1","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.2.1-master.0c06aa1","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"c8a098d395650151e05798638ea71ecb17fbe797","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.2.1-master.0c06aa1.tgz","fileCount":19,"integrity":"sha512-BTqMQ6Vt2+NAfGNhNg9n54fjl+zvH6krZZ/5v4+LA6OFjLHUz+fwAFI48sg4sIN2GHcDr9ONbtgMZ5OL7NHTeg==","signatures":[{"sig":"MEUCIDN453UqOJMcx+JAjaT6XZUX4z/wp9ptFSKe25Yu9IbCAiEAoG+TcXfuEFpGxCIvh2oe2T3+slY/4H944yu3TAn2QUo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":233710,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnnLyCRA9TVsSAnZWagAA268P/1NoxFiD6YKhgYIHJKgP\nGiplxUTTS8FhHoWbD+pGTPc4uD5FEESKEauQh18q0e+F3ic8mxZUnk/fJ8cJ\nVFLOe0+5H3M0nmgZQLqabsvDe0Q3DwAp1nItPuepJLHmL7rriCAY5MC0ttJT\nYt9mLDGFdeSfnN8kYw77aIjEtwUpZ3CqWcfCZdr+AW94ETFrUXnzuDIt9d1K\nnv/vVlG6OXcs6C/GJ5E2zPihyFLnVURJ6AphzCyol/IwefJ0y3k3WqLcYGOr\n3Wtu0w9vk8a2DeyNwTkFcAn0WSrAe1Dkz6kCLEi+5jjxzNDOL8Ac7Krczz81\n8I5pidpQKGOZI2+se+xoXYOxyo8w+xWwDs3JAGx9RFEXwLYz/Pu7Yw3icTqO\nmyOCL/U/ttChIg7eBmfRTnRf1yyIcMXIYWf38ad3yDdbb3WpPL+3VSUl3Wsx\nQ4yTGRHelZWpdWdX6JxGyObmwoAAmL/T0W+NXqBAcx591+a2HjsAMD+A7Qdp\nk7DVHk7IJcRkyZe16tAP1gpNRWrPlvvmA/+IX+JtGWNp5hBoNXzKO/WfYwcK\nT16lXc88zBxGaHKBKpjhkg1mukEtbm5MTi2JA1TaGArFxjxdNr0hHyJLS+Qw\nASO57nXXBtEmnyFaod7NN8Lr9lBKThxp2V3NOhvpN/Sj3luNRIx/Ip0CTt5+\nAeBd\r\n=8Yxl\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"0c06aa12db0838756c0e7e5cefd2ccea0fe62c39","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal --entryPoints src/index.ts && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint:fix","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.2.1-master.0c06aa1_1620996850347_0.7240989383711631","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.2.1-master.456a172":{"name":"json-ptr","version":"2.2.1-master.456a172","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.2.1-master.456a172","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"dist":{"shasum":"743529581acaea511f4a9dba6cabab49192cfe3f","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.2.1-master.456a172.tgz","fileCount":19,"integrity":"sha512-PQutotaaAnRQTKIwCszHjTx+bhgd7fhsgdjNNWAdTc9lc8bKqRDTkEptcdIt/JPaC2J18v4WtUnboT7o3ZljPw==","signatures":[{"sig":"MEQCIGj6duapExsQcC3+we+Xx7E9S6f30i626feJGyC58kPUAiAirKr3GvWTUW/EE2W5KjLocaliW0/IpwSCPe45UMwpHg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":233645,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgnndeCRA9TVsSAnZWagAAHSwP/jo6gvsYQhMyZ+cgfbxI\nrDteM2vmCAnBsnNfAFH31TAWz20crnqHXcWgSb8Rtm3QLWPHPI3QDSnww2ay\nzukbTVsLuc43uOxhXmIDyp43wWS2v0RIInVtUZ/VVxXHUh85AyDHFBa1ar58\noA91BbUo3lDHhP81fqSchOOIk/8cSdcfxG5i7AGexNEqKoTX17nDuB0l1uAe\nmsKTp0bS2BsPwFfdenNai0SwKgeJLT02E2m4O3GsHG+INNbEK7yb3g2RyIUR\ns8HqHKvrhQDHaGMdBjrxoBDD5uvep6tqf4C28z04Hc+q1rjcCqJr42P47idb\nBu9Cpsyilq/fMT5cf1YPC4JRjTGdrssqeJaPasIJWEoCDKuTNU2ZN89d6LR8\njx3KtsQ5kbAastJtKrmFJ769bF1KyQB67LzeQJczakRiyvW7sRBrSGSIUoXa\nrteGogktS9ZwvLIIEN5oDJ8m18M58LnlCpPzMy3eI7tkhIrDjDeD9v/A1FNQ\nvYrsvtsxorqNESlaLnvxp75b/oR468Cd8YZwEDl0RANxrZtbhxvYoB08GjLE\niXjHJf9/yt+YKX7lWnGRGSJQz+5OKxJD9f+vW0L8+JU2/GQqW+Gl8G1Deutu\nDd82zDrAEjL0m3VlDSUvzspxLcD+riVneea4CsmFTfO3Qn5/ntbJ4yu6VUMp\nHAZi\r\n=Uzj2\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/index.js","types":"dist/index.d.ts","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it.\n\n## Security Vulnerability prior to v2.1.0\n\nThere is a security vulnerability in versions prior to v2.1.0 in which an unscrupulous actor may execute arbitrary code. If your code sends un-sanitized user input to `json-ptr`'s `.get()` method, your project is vulnerable to this injection-style vulnerability.\n\nIf your code is vulnerable, you should upgrade immediately, and also, stop sending un-sanitized user input to `json-ptr`.\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Use\n\n### [nodejs](https://nodejs.org/en/)\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  }\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [{\n    name: 'Wilbur',\n    surname: 'Finkle',\n    honorific: 'Mr.'\n  }, {\n    name: 'Wanda',\n    surname: 'Finkle',\n    honorific: 'Mrs.'\n  }, {\n    name: 'Wilma',\n    surname: 'Finkle',\n    honorific: 'Miss',\n    child: true,\n    age: 12\n  }]\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.'\n    },\n    additionalGuests: [{\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.'\n    }, {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12\n    }]\n    // ...\n  }\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n\n```\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn | Static Fn | Documentation |\n|---|---|---|\n| `create()`| `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n  - When compiling the accessors for quickly points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n \n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n-   2020-07-20 — **1.3.2**\n    -   Added missing `tslib` dependency.\n    -   Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n\n-   2020-07-10 — **1.3.0** **BREAKING CHANGES**\n    -   **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n    -   Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n    -   Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n    -   100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n-   2019-09-14 — **1.2.0**\n    -   Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n-   2019-03-10 — **1.1.2**\n    -   Updated packages to remove critical security concern among dev dependencies'\n\n-   2016-07-26 — **1.0.1**\n    -   Fixed a problem with the Babel configuration\n\n-   2016-01-12 — **1.0.0**\n    -   Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n-   2016-01-02 — **0.3.0**\n    -   Retooled for node 4+\n    -   Better compiled pointers\n    -   Unrolled recursive `.list` function\n    -   Added `.map` function\n    -   Fully linted\n    -   Lots more tests and examples.\n    -   Documented many previously undocumented features.\n\n-   2014-10-21 — **0.2.0**  Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","gitHead":"456a1728b45c8663bb1ac20a249c5fb17495ec6b","scripts":{"ci":"nyc mocha __tests__/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc --theme minimal && cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"nyc mocha __tests__/**/*.spec.ts","build":"npm run buildall","clean":"rimraf coverage dist dist.browser tmp docs","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","pretest":"npm run lint:fix","buildall":"tsc --importHelpers -p tsconfig.release.json && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","precibuild":"npm run cilint","test:watch":"chokidar \"*.js\" \"*.json\" \"src/**/*.ts\" \"__tests__/**/*.ts\" --command \"npm run test\" --initial","build:watch":"tsc -w --importHelpers -p tsconfig.release.json","build:browser":"webpack","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.12","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"12.22.1","dependencies":{"tslib":"^2.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^8.4.0","eslint":"^7.26.0","rimraf":"~3.0.2","process":"^0.11.10","ts-node":"^9.1.1","typedoc":"^0.20.36","webpack":"^5.37.0","prettier":"~2.3.0","ts-loader":"^9.1.2","typescript":"~4.2.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"~15.0.2","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^8.2.2","chokidar-cli":"^2.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^8.1.0","mocha-junit-reporter":"^2.0.0","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^3.4.0","@typescript-eslint/parser":"^4.23.0","@typescript-eslint/eslint-plugin":"^4.23.0"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.2.1-master.456a172_1620997982196_0.6437850774667699","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.2.1-packaging-rollup.7af30ca":{"name":"json-ptr","version":"2.2.1-packaging-rollup.7af30ca","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.2.1-packaging-rollup.7af30ca","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"7fcde165802e235e159cbfedc148df39c2f998c8","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.2.1-packaging-rollup.7af30ca.tgz","fileCount":17,"integrity":"sha512-FaD0BPfIcdSUavFi/5q72f5ehg2zNYxAomi9fv4Xxx9u2v6b9KATwyOhTYHxKdp+OKtfe78XhA9wAmtDOPqi/w==","signatures":[{"sig":"MEYCIQC8+DRYdR3VzNZT9G7+AaBU2ywzajBNifKvbec5N1GuJAIhAPMYhTDNjCLGXpa2b33MIzUzRD0z+Oyw3UxBaNXn9+lx","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1501073},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference to `json-ptr`, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"7af30ca02e0e41e574c5ac3a63ca87c712f45ef4","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.2.1-packaging-rollup.7af30ca_1635263504943_0.45257312772646374","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"2.2.1-master.18a4d58":{"name":"json-ptr","version":"2.2.1-master.18a4d58","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@2.2.1-master.18a4d58","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"2645a31828def8d3ffef606dd8ef33f4bde3ada7","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-2.2.1-master.18a4d58.tgz","fileCount":17,"integrity":"sha512-JKuoNc8GEFWuqbcgkzRgsa7XMr9EAfw8r4xJ3NDNKTZADOxs36vIoG9epGMDAaVkNb6DSykhfD4dx9Xd+3J/+w==","signatures":[{"sig":"MEUCIBXRILCJ4WOhXIn+2102LrKd/yCuXRE3/fL3yic+bu89AiEAzcLalW0Y2YMIFPcescf3Y6S2OnlIIQX4ASNFjNEw+vY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1501063},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference to `json-ptr`, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"18a4d586b679678f67a3f06bb6f593e45b1d9c37","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_2.2.1-master.18a4d58_1635263680863_0.4401283922482364","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.0":{"name":"json-ptr","version":"3.0.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.0","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"77dc484740270c6148fd2778f000f439c7f08ff2","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.0.tgz","fileCount":17,"integrity":"sha512-p3hBrUrcbzAdmIVOQA85C/TvapouI1M1YxLbrM0lEs0AVLweBqNfZcS1mlo83uneHBYYtc/T4pzHZzrYNQpu+w==","signatures":[{"sig":"MEYCIQCqK5uPQIiFQ5IAiZDQUABUBLtw0jjvYQef/9BciSS6jAIhANVtzepiOKptjU7RwIjVjDwdmOuQ/ymAHB/FIRXnNJV0","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1501048},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"2d8c1ab7ddec15ce5f6e94867de9a2abf5c41cf6","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.1","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.0_1635263957561_0.9758932367128275","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.1-master.2d8c1ab":{"name":"json-ptr","version":"3.0.1-master.2d8c1ab","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.1-master.2d8c1ab","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"9a95e84fa2a5b7d2529bff821e43104d3e4d7522","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.1-master.2d8c1ab.tgz","fileCount":17,"integrity":"sha512-NTUlW5ci04OVM+1yq4jI4sXjvzGkFkyH8dKI8MY1SbjNPaaiP6qCYJrs/DXIfQv7ePI0UDeWhTep1HtnZRS2xA==","signatures":[{"sig":"MEUCIFVaPUK7CPOXLxXMu/1m9yL6YcA/y6GputA6MOPBM8gEAiEA5oR+DHwcBvQ82Pz7Rrji8YJPZo2L0HFxpJxo/U/eS60=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1501063},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference to `json-ptr`, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"2d8c1ab7ddec15ce5f6e94867de9a2abf5c41cf6","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.1-master.2d8c1ab_1635263966038_0.8241999493368639","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.1-master.55c1dd5":{"name":"json-ptr","version":"3.0.1-master.55c1dd5","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.1-master.55c1dd5","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"2d31170e8999638fbf3dc6c59482b83a8b4a6c3b","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.1-master.55c1dd5.tgz","fileCount":17,"integrity":"sha512-fo5xpza5EBrP5SpBphafyfde3ufYafyzh425vglCWiSNz+OV/270k3BEWl1PmBy9aqTj8avjcCB+PS/AjleteA==","signatures":[{"sig":"MEUCIEYWBa/sSGPMC2Nq/xmnk/3UXTtz3EucmoBot2Z4xPehAiEA7WwRgfHGuQ5akob+5XvQYhjEwux3A3IAJwfhnuWJws0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1501143},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"55c1dd530aa9683e8bd9f31e4b84de4683153aa2","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.1-master.55c1dd5_1635290307956_0.3663053865653272","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.1-older-nodes.e0918b8":{"name":"json-ptr","version":"3.0.1-older-nodes.e0918b8","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.1-older-nodes.e0918b8","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"6e58338c0e7f321f5c3087442b673ff964c1243a","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.1-older-nodes.e0918b8.tgz","fileCount":17,"integrity":"sha512-QNb3k+Mt9dNchohUg06XJud0S5xosl0tsNRXbFNbjd7PHagJXCa3qB1u8wiEyMulYV4O/uQ54pE9v1IfdkDb5g==","signatures":[{"sig":"MEUCIE13hyEON3VpC92QHeSCndZQT6fpVLbe3rkwAVhzK22hAiEAmIxByJpBWLKsVYAj/DdBmW3le5mMpX82Rxmt8FS9Ba8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1500912,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhmDInCRA9TVsSAnZWagAA2QcP+gO87YlzmI+GkKIyAFgd\nmcLsEwkuoIQvkV27EXOqATauc3BVcSHZ9rcyWeFsOtVhQg5jvmcoNpNuVRsy\nWVW1/vEWGdwWutKzF2Fp8Fo5hkIFnK8dou2i33UTHnz/8iAUoSr7JvYlULdx\n/6KK4Ich9h7ro0IDhtNwXB0ZsFVXYUpwlxMeyspNZ7lPqpWhDiMzqG+6Qvvp\nhDB6tQ4hrqYBu0/QPw0uv17s7zg4oAU4Iv+pUJGazZ9IeKaRvrhPLLPSbqY8\nnoOsnjk3AG4DcLbABsG4IFRpEpC07Z3EuM4dUOp5SDN310+390OVnj78+HEf\nyGFKT+l99ZfFQNnbFNSGJcnPrq4UzqBjevHJOsbnbJ6HwvLv3jsgSkM0NsNd\nVowpEGKuy4cLLLeesjSABWpeXRDcy1yuVbN3qYV8U/S6YVLcRcD7mmAVTU/f\nSBBd/rZm1dtCCdmfSljrWtsIX9jT8dU74MJhr9jDhvYEkgqnlbK7ApXD5VEx\nIhzkV88eEUY5IUHFfz8NvTt/Y3liFTKPqY1M/lo8kYN+d2Vt85oNrIjTqQZu\nI+ARGiXvhKsWQMsiQesuUSJZW+cHxDHDXXYyuVWn3P1Edn6KTyxUw89/QPiF\nWruRQuNIGPj5FLZp+v3tWsxBxe/pS2XggNPjXzfdFBsmxiXhm9gBSRJmIBwM\n8qA5\r\n=SwKE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"e0918b8b7f68db4342aca6c85031a8b08213e005","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.1-older-nodes.e0918b8_1637364263546_0.43508040237753143","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.1-master.cb11e0b":{"name":"json-ptr","version":"3.0.1-master.cb11e0b","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.1-master.cb11e0b","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"fa073da2435c9a10c77b014b264dbb02eddfd34a","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.1-master.cb11e0b.tgz","fileCount":17,"integrity":"sha512-Gzv0FDB16igrKXD+qXrj/ywrMJQlY8U94+inQ6BuXB5J1lej0MJQ8q7Gox97c+QLyfSHbtQrrL/nAd/32/mL+w==","signatures":[{"sig":"MEUCIEEZPk4wT5y2hSxA2leL2T3yxGSpeE/85x/JWnCBusSfAiEA4WayUpDK1YP2iJtrrDBHU90r6w+7kI2DcJvR78Rp+to=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1500907,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhmDJhCRA9TVsSAnZWagAAsbcP/1MRD9TT/t41X9fewqAe\nlI1gb+i19tV07Dtu2t0D1bC9uxuR0Lq8jn7Egu/QVMYND9eYd+hhfoQro8j3\nb00EO3rB2X0Jq5yEHsQEDYU5z96chpxI5crAfLRdQ6PVE5+HjWuVrWTpmlYN\n8DU8BWW6fcjdw+WV0BPZuAgHnu/Y5I6XnWyWEt6ow8gJbb8Xogir/9VK8tlw\nAW7R+k4prb1xi7SqSylfq+CAQz7M3/vnbpv/goOy3dK3rVjS1WjsY55v26nf\n5HqQyus36GoLau8L9HseqNW5sDWu+59iQatcHOetTmQmuKWE7YTzsWzUzPCA\nNW1et9d3E0gpFgK84CFUFVQoZv1LjPU3uWSBha3jF75hYelVVA0KbFcD+y4o\nqjw0Kt9AuRCWaOHhOIMcQtJVqvgwiTjjhKQB0sL0Y879jKa6qCiYFArTi9wu\nlzxCb83FtJi/eePrtWGogOVd/1gnP9x3FLPbXDCCmQH2TZaGWV7uzI+nZgfG\neU2lU66zVgTBXJHK//OCe/3N1KG6ReRykT4Hkk0KuqOgMP+n6w8JgoAYJ/9m\nPe24ofrEyTYiWg92Qngi6AbMhAMp6f2KiLqAQXcRUZ3OJgQIU6re1pALPo+V\n2J8/11w5IZfVlZv/4qf4+dy6UyHfs5z7ipBznVUpfKRpAfFtoSmI8f+RejoE\nw5aQ\r\n=WeYw\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"cb11e0b3c62ba8af7c10023c54239eeb432d26a0","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.1-master.cb11e0b_1637364321708_0.5416096889386091","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.1":{"name":"json-ptr","version":"3.0.1","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.1","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"b4f53bbc13ef0d7eacf675770a4bd8c16453463d","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.1.tgz","fileCount":17,"integrity":"sha512-hrZ4tElT8huJUH3OwOK+d7F8PRqw09QnGM3Mm3GmqKWDyCCPCG8lGHxXOwQAj0VOxzLirOds07Kz10B5F8M8EA==","signatures":[{"sig":"MEUCIGibGn3kbGTTNFZhoT3b1afx4NjQbu1UwWpy3PX/3xAVAiEA/h+LJ/068vJxEUfLUaFymd6HLUUm+8nI/TlUuU6Xtos=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1500414,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhmDSACRA9TVsSAnZWagAAnI8P/27SUtN3KXm3DEdSZl5k\na5J9jJhLUzNXCLE4mJxGohgza1Np6V/UiJVmrqhKy0Wh6/xDqva7i36GbGrD\nLOoK2+kGRINPSQZcZF5BKO43/sRSu5dni7GXVE24ifUEALZPBpShJkqySemu\nodW/UnsdGcm0a4dzfjNuGUArAUAVUhWjmBEeQNGu6CaxNxesPTwm1Gz2nel8\nSNPQE9MCex0S7aHuWQRqLJe3UjCO5W2H3QVW9Jo0sos4Nw5XgRC87hR0iVkE\nGN5crlHFA3NIJBsx1bchzY1VTUPBrbQr6/TbuZNyC/YQiKtjNatymIVx5gy5\nlrUEc5oiX3N+kLO4PZXeXxvCc0JvRRzs+GLQsusHzfpYU3mM9+qk4WDQ8MEj\nu+b1EdMZYRU+j09qte0tF0w9mdXX3SSH4dEnv4SIy6c7gNadp0xl1OFDAus2\nkaVcCDuua6T735k8CBlEdCMAg9vusUOTnpH1LrRtnM1bITXzm1F119E8xsjj\nZPBbGlpQ1LOtm34ortlGbNV3jSzcPykicU+/gita7vnkcWoXTJu5t+PcCTrl\n7V4vPJj5PH9yl1zR9PUr+A+bOVXbJsV+oRQmRpw6tBHOGdFqstK0mBRlc35C\ne9Az8mjpNp0TRIPcNG3Hvo6Tgf+v7HVfTxLRqq8F85vcDurC+LkcssFl7RWY\nyAjp\r\n=OwXS\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"a2e00556b2d39ef69a6fddf24cc3a4d8e07e4549","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.1","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.1_1637364864803_0.8741730883701622","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.2-master.a2e0055":{"name":"json-ptr","version":"3.0.2-master.a2e0055","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.2-master.a2e0055","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"ea4e6f96dd512c11b9ff9da8c5ed121c34e8cfa7","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.2-master.a2e0055.tgz","fileCount":17,"integrity":"sha512-rySxfTZC/wIcsfsXAOqtfV0VS08l0XPmFKi4ZaL9w6p6giewlDGS4QEi8LGnk6piUNNWZSRH3YDezgSyIfz8Zg==","signatures":[{"sig":"MEYCIQDtaSNQxIppUpjYeMqkpugV/7vGmoIK+bwuhiyI7gOzYgIhAO93HYXhqON69gz8fE6hiNLwfe3LAFJQXs9KpE05Pt+t","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1500429,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhmDSMCRA9TVsSAnZWagAA59gP/3L7f4zflfPRg29EbSNu\nKgAKxsQRxLlilyw3pGNfjssVrzykBX5P/z1jo1S8qF38QUaWGUiS2d1jCHMX\nrq9Z8YYE7wiZzKjxP9AfC2/1zlcCQEDTlN7J/AkEm9g6X57aYX9omNockyMC\nvlR3cKtXHsLKVyxpUc41ZBULdsab8KTphMvTrgtwcnY6wpa81HQVARSRgmgs\nsAh7J8ayKeAFfeDmRC6WhKvQx1ba3KpU/gBq8RIaxLRhm1BnrN111S123J0D\n+CZFvDLvduO4UEPDlodycsF8JG3dTQi0kYFm3n9UkXt68UFKLRXWQpAPnwt2\nP0rhCa5o1c51XyKi6x2Rr5ptzN1QtgQ2Pk0hpE9kcoXL9psQi5W6el897VMx\nPJTYXQbNorG0my3znU66Pl5oMBLCena5eA8j6JypbRJRvRlgxO+gdruIUOO9\nCD9BhaggU1v9Jcf/THYIeFlGPzWub8pJTHHMbRsDjrKIkuU81WjxSviakKwL\ntZEZHdMEsbIWraTnmxjYdZk8xw5SplXhZ/k5X9BPvSzymg/w9MaMZs3CkfoH\n/Ypic5+Z+cvFbPIRU00kJGuB3ZvO/1/7caDkfIiz6yAE7zAcFCUSMwHAiq9D\n77H7em4yvbUHYTiwEU8VOIUwANA3nDS2PcGvukg+G10x9KX5mXjMvdQxktIo\ntqm7\r\n=Lou6\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"a2e00556b2d39ef69a6fddf24cc3a4d8e07e4549","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp _config.yml docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.2-master.a2e0055_1637364875936_0.5914283469908237","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.2-master.2e0b67f":{"name":"json-ptr","version":"3.0.2-master.2e0b67f","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.2-master.2e0b67f","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"8eb736f5e7da33093d2d89d86f88c36db9e40b61","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.2-master.2e0b67f.tgz","fileCount":17,"integrity":"sha512-hd/HrBVTDNotkYmmQ7aYoXokb/3MvOijUiSvo9FWDv8LuD25c8FYrk+Gog1UYtD11nlPsj/uKyCFmFlgJlhBNg==","signatures":[{"sig":"MEUCIQCDlViRfUXBHnfpkTCHnpbJnCE8kctwMnqZWryGZffeeAIgcbD45wXxjJi6DR7jtkj70tDhJNYNtaiwxdyP3NxOk7w=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1500432,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhmDl2CRA9TVsSAnZWagAAJFEQAJv09hvCsTH+NHarxeG4\nP2aV4x/rXooiQSNGX4Em7l+ZbtdkKNUyeb+KC7xe6VT89LeHWqExTV/7BccB\nKt1nPLbLoeVHAWWXuN9ENIIrSLDy4eciRqBEkTw1A9OEseKZOhP/h7b+1jZS\nV0diIG73VBwdSU5Vc00wADKYYPSlz1Ym4o4y4cd9EiKaDCan6tfDXPalG/s+\nsfb9KUBvjMlk8FKXUprd7KbwWjq06pzbIiiO4zVim7LZV7JCnxmf/I9NpnNf\nEYRia69eWQimFlls3y91yjAqWi1kZFSn+fGuutsnUfBhFOgXnsMbxS2QPlf3\npxNaGBIXL17CO6DhsdTgFM12YcvuiYRrs2VSH3WPaK1zjTlQzPt439w+OSX/\nPYm45IW9dkCSMHmm0phvr2KeCwakCCQnGezkU2Euh/24KYcc7umV7ARw42Lo\n+2g5vnSOkgvdTBf0jISnMTjw6Et71aCuBTzOb+naiQ4B7CPfB6nZdNhXhnB8\ndy9J4jCyFVPNjmvcpNS5lQGxgaQwR2FXADF7ZBH6oAChh14pLic6Lyke5AGt\nwypeIMtfAKSRuFjbxkpaFljoen6IAw5lTR6rOWtdx/a+OoA+wrIi7i/YpQ6B\n42oU/7jf9yFEOBoyXP5xRkCYDnwmZDkgUB9TQ+TQIt7tv/4L0ldeRZF+CmSp\n4wFi\r\n=dzQW\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"2e0b67fa283694772ae6482e59e5d17b7a3166e6","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.1","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.2-master.2e0b67f_1637366134585_0.9602254156223635","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.2-bug-issue-48.6c9db9f":{"name":"json-ptr","version":"3.0.2-bug-issue-48.6c9db9f","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.2-bug-issue-48.6c9db9f","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"fc4e98aa815f6782608e90d407a51cfe66ef0954","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.2-bug-issue-48.6c9db9f.tgz","fileCount":17,"integrity":"sha512-5XicFfrEhp1BU7rFvlDGCJi855jeVKJHeo3gy1TX/UC9OKJz/aCwRDP6+CqBVKp5dWq3xDrqgCorUdzLW4xR/A==","signatures":[{"sig":"MEUCIQCyznZnDr3cf0PX4E4wAWd8duKoVzngRLVDbbBp1aGg4QIgSs1+CY9UA2CJ46r5OK+J5fdNRQA39k7UQ25mu8kzPGY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1505760,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+usZCRA9TVsSAnZWagAAkp8QAJ9UMviCga8LLz1xWTnf\nMAZ6HmEBouUHUg2op85PkqijJEdGY0PYhgoS6xsrZO7+/IMdwcOIN9BdxhxO\njpyJpSbtCSCd7OuxNZFF0ge32ii4VyuNQFiNagfSuHbH9WpoD/73fS/X2LGL\nn/gc8hph3lyhYZ5GTLisgJDnukRRu/DELIo+BtqdjTSLh3X8t6U48cQsDaRs\nNR8/rXkg+V7BfIaG2WNit2UHyEH5C3kAFfcVKDhYTcRfYrqoVuYyNPea/cV4\nz55mMMzLAefPDlCnCOoMmYAwZC6PmyrCrdvDOx0KS4AzGD/3G4Rmr43gEKv8\nFUeEmFKcfXWB1ukM0uurgy1+TIehIkEYzUhsHgXEOzEbbPZW9J/RaEcD6aVQ\n8Oon1NAQol4GdjDqRMEQ/J0sdHrDt2kwcPk6B8L8oleuD+mIm2a2h2MUDhTA\nmGaxxpCNucjDNOu1yUL0E+l6gGZu5DrIeXCOm1D/zHrXPjFsxB37uzxBKn2e\n6L4Xdbo4uHeFOgVXVbmuAKlcnPlfzbd4SNuN0OYfvblqybH4DzPDbOTPNksI\nzIqrlFaKRreQxmCkNh7npJhOuWrB8fz6SHtjbtSXChQc2L94KaNjO7Wuutg0\nBkhtqg1//ziSUfWURE1Jd/dyiGxLyfk8rKrEXaR+TpS6RqycyPsf0dzaiq8T\nAhG5\r\n=SQAm\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"6c9db9f30253171979d48fd401aee3e289a281b9","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.2-bug-issue-48.6c9db9f_1643834137309_0.549505057863173","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.2-master.50697cc":{"name":"json-ptr","version":"3.0.2-master.50697cc","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.2-master.50697cc","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"8ab4092bc2b1281f9d65b4140fd02d8caa8e9c83","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.2-master.50697cc.tgz","fileCount":17,"integrity":"sha512-EBUuzw7EnDWR7yvBx4CAKyRmkWgxcj4nLWZvRe4yL+h/YB/aQWtfGV/eDxssmIoI76xSdPJEuG8UnrE/RDr7Bg==","signatures":[{"sig":"MEUCIAWEIDYW6f/y0H9MMNN2If51g4rwDL4HupFMt0vNUdg+AiEA+j9QIW6Jtams5f7CV2/tWLuLnzIVUHJI+zOXBJUgvJw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1505754,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+uu4CRA9TVsSAnZWagAA+MUP+wU3V9RxV54c401FBPSj\njP26ASJpIn4Z8bMM12UXGcS2MRhmtoWcxGagihFt5rb7PcAiSmpjHwD7SJPa\neFXVQir+NIVWWOqa5pUK0mcdgr8FFLrl1na6Z0njRG4ZcWgTbdMBYeEGOm42\nYmTHGo8U9GnAjtJZ1zHCUlMrPtF8vt8cQwsRtvnFDycid2JMBgtbn9W9nxYt\no31vYuX4gt1JgLW7iT4+oMh/uMzay96GN/e5QvoktI7ZG171yEIpAefSCKg0\nNMBWxKGy203oeA9pYW4imfsl+sqv+Grjw5uGuQH55GtcsrLf2NKW9VcEHzcP\n2JTlN5hKtOcvvdLJY7O0cdgOcsICxVf3aZat3tPOrlfjXWDahY+H9DVJeENo\nw7q1aPZSKOtS8Xm5DRoXHqVsg2OlR9KRt2Xic+GZmLtrjl9CTss3aBIvob6B\n2YGffEjtBXgRX0eHn4FrVEEV8mdpGCrJSVzA6VdiBoHchMq0GC6sYxDF1qIF\nKtB2ersBUE2Z+9PDfx3i/6WLBdWcGQOnkm2p8paQ4l5zTcLUTY3+n63cExTu\nqpOaqQxqxXuX9mTxuqbDi7ijrTsmZaZj4oROMnRxTXkF7PrLFsNspmMJfKKo\nLSqVeSjBg8Zg0C6yDTp+cacK9ipGEfQhtufnP60QivCxFtlg3G1Xnoxs2dBX\na6Mz\r\n=//dB\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"50697cc29a8cbb798776663e371689bec9e634dc","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.2-master.50697cc_1643834295818_0.33878234937573337","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.2-main.50697cc":{"name":"json-ptr","version":"3.0.2-main.50697cc","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.2-main.50697cc","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"876c521a1b62cac2b30cb2abf92a5aec5cc1b0c8","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.2-main.50697cc.tgz","fileCount":17,"integrity":"sha512-1YxdkrRx6MghIRuUkTH49p5ofkrUkob4kFm/efx1OA1DBToycwb3UU3f/sgyrX8EPrR87olver7IynJOoGvzLA==","signatures":[{"sig":"MEYCIQDP1ivx7FmUaf5rZ/GAbAAk9wW8tIv4x+jIStD+gUj2AAIhAJdRIdof5XLSoKfbC7spGcmWjrPNVoTSWxnXJUhnYQBN","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1505752,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+uw6CRA9TVsSAnZWagAA3PsQAJtwFNIUuFxyIgQcbdNH\nhyLVmuL2R6Ze6aK+x0boW0OJ+P0cBGdLTilobwXFerBD/eySl2PALwd9FLNZ\ntNduSZgYaghkk1A+V6mLOtVfhBZQ4NchuE0RVBqW19SB91yqo+LpTvE2BQcL\n6OSVoZJXJ9o7sFQhg0SInhTd96Kl8sqlgb1n60f2fZ1KjGHMd3XGNentFh/0\nB0oNPWQUCN/W7wYUTo6tt3Mtf8SLtQO/5pMfp0ZBxyoiq8Y1+mWaSh7lj6J+\nW4n2sf08BYvf3ukr0UIXLVVpBzmLU/wNiaUHxVI2HzsyrW/myNvY0Pn7eeoJ\nTnYQqvSehnApaCw1+HbUfm/pFHz8f6EXyQHxzyG4g5HuQKiZcT5X2rusJz2e\nDV98g+yacA2edRvhTn9+2c5ASD90BCFeQBZhv5vUn3NQSOzq4tCjGs+nlItW\n3yqPXEg252GRYVB3kyHVTx/2xqv8QONF4+lHOo+cd/DlLYJEyYLIyq/88cAr\nhtgEK5/aV4rjpuB9mCenVv7PYOeXUzfbbX0mLXFquO11V8RYyzHiBKdhJrsI\nZuWrdoOGTH3w/cLPSGT5NrQBxA8Ozw6RYr4kBtBS8fUaeL5FGFtLqnCCibec\n/TJhO2HXIwMjwV/nxSVZd6U4+HRbT3RyuNXgIwaTCtsfjIZuR+qzX18mPiK0\nKNgC\r\n=Ihkt\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"50697cc29a8cbb798776663e371689bec9e634dc","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.3","bent":"^7.3.12","chai":"^4.3.4","util":"^0.12.3","mocha":"^9.1.3","eslint":"^8.1.0","rimraf":"~3.0.2","rollup":"^2.58.3","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.6","webpack":"^5.37.0","onchange":"^7.1.0","prettier":"^2.4.1","cross-env":"^7.0.3","ts-loader":"^9.1.2","typescript":"^4.4.4","@types/bent":"^7.3.2","@types/chai":"^4.2.18","@types/node":"^16.11.4","webpack-cli":"^4.7.0","@types/debug":"^4.1.5","@types/mocha":"^9.0.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^9.0.0","mocha-junit-reporter":"^2.0.0","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.1.2","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.1.0","rollup-plugin-typescript2":"^0.30.0","@rollup/plugin-node-resolve":"^13.0.6","@typescript-eslint/eslint-plugin":"^5.1.0","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.2-main.50697cc_1643834426618_0.8898253522388451","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.2-main.afa67f9":{"name":"json-ptr","version":"3.0.2-main.afa67f9","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.2-main.afa67f9","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"6c7e0eb1046776a7844806821bdd8b3db7cc287b","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.2-main.afa67f9.tgz","fileCount":17,"integrity":"sha512-8aCEJZz58WvscGuBbBXHJjeIdCtGKLKCoi6M9OPDq9D+PAhT38zdDwAtK2V2apy8bz5gkWxjSzBe/Rakb5Mq1A==","signatures":[{"sig":"MEUCIQCNPVFOE7DV2vDUZu+LgRn3Sda1uZxAXRkL9R4IqlHkagIgMmNo9M3WibSvmoW1Saetg9gWsZGZ5W1ouV6B97+61nY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1542616,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+vB9CRA9TVsSAnZWagAAGaYQAIwXRt2YQ2yoDLmeahTa\nipiqlGM6E/xL3quDqIJP1ObGbkGW2pJPqHMolx/wgjVUr14/DSgmw24P9mCB\njDp4TmC5Ju+sJmk/CnSBlWo0XDCjv2QgTZtsAOx3QySgDtcmdfvS80Am3RWl\n4i/GJ4SJU3mMDa4ojRVccOEk6B4MGOcEAZEhE2U5gQRVZeok8JGNH6pxfudH\nNBttntjs3S755CXUvkDW8iJ6Dz4mcbUCZVfD6y7QNIzqTVKIN7DBZaJHWpr1\nUzJpmLUX1SItGBB4BfHyhjldiXnBSqZ7DxJAl8EwdkbRzrwodotERAGMbnQM\n2xqOsZXF401BQc+gHJ4kcjBvtzkctVXXL4FcAe1vK4qDKeQCxlhTqOptTLrq\np2rbxS41fewMLAE+D3GUKdgF/ZcSC0DI5VHkiGTBKzNsg3qweHZFgKQPE9TP\nsB1lcB1kvCTFOh/rfgOPFV61WvZZxHqplBbnWhNdsz6658xujAXGrfSXRQFO\nFk+Y9vSuIpQYoLdX6rZTBckSbauD0s9GpNM3YNJg5+3nYOMUOCDyEPiKk0qh\n2Ys9VMtkRucpBU8NtVgWS9/VscLHkLuPlAmiWVVnzq1VrH6mYPIxcajji5VM\n9P2iMgj62cqyNGtJYMUQRxxNLONJGrQl9W/kz5FN/BJHUVI+nUYMXAdRgRFT\nRR7p\r\n=GrsC\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"afa67f9c0028186d5c7e8b3293166be2fc156fd4","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.2-main.afa67f9_1643835517296_0.023134971024530993","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.2-main.e7bd39d":{"name":"json-ptr","version":"3.0.2-main.e7bd39d","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.2-main.e7bd39d","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"0505fb6dcd69434756ef1aae64f47bfb9e43e02e","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.2-main.e7bd39d.tgz","fileCount":17,"integrity":"sha512-khK/pSb0koMFO3HEgClJLy6UjK/M4PrVPSuyI1zEu1mwAmdQudPXNdfvRQma/2dNgEp1WJ4gAdfnSATfOYVUVQ==","signatures":[{"sig":"MEQCIB1iAr8yA+AdDKStwOcVzjaVqeedaYhtzXMWdDrCuUvEAiA0bOzG+7NJnY7ObXKpCas+lew/YtWNQWOjZIVsQq5UVw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1542616,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+vE5CRA9TVsSAnZWagAA9asP/0sEjoFF1C5FL0PNSPxg\nlGNI4D2NSEYP+y/B/Sjdf4mAgbzGG5RpeRTzxOBD1g+MzYc+tPus6u+9IFjz\nz0h5hUBqdlnXQIMHt92Rj+W2F0Ov/y4wTp3huFrWqR1MiC77au49dS54a95i\nWqXdbiRCVcpt0ik2KkpmGy3DIilhEg5i7XcZvCGFC2R5ErBdaj5bbZ1ja0PH\nx4X1VuJbFV+YiULUVaHASn5oQ4CbOl1gQ/o5rXCals5KTkeIDkRNUoNGIp3V\ndhAjPTPqX8w2xvePz7SjgL0+3XgI32zCQ1PPC49gSWNFNzRSJo7V1k8uaf06\naxWtWUjPpA6+eFu65wlIpP3mmXY65nJm8G0GoqY/Vcs7tw/vprjgmPg/01NH\nZr/ZWWNqK8fqew4lIEWNEHu9z6YGpUnicpsF0LPY1tZIg6jABT3X5WWav7Hb\nT6JSdUib4/s0inQ1jUVl8HiGdLvF1lMH+FaShiNmPc+/VRpUIg0aiVYgXY1o\nGp3SZVRl0dha47X5YCucVm7BqL9TJDwzqG2LxYYRNTPsTVNFKkYD7m9r7qTJ\nCCWlatUfDn8EvR804gpa6KejAUmxgaQOO2xLBGEvAJsKHtUKUG2rTwSz19j0\nyCyJf0vZo44vOeqtT57npeaUS0reNEvifv95qUNmisYavvYSEdvVTfFU0HGo\nBtaX\r\n=5xu4\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"e7bd39d9cfac7fc5cd10a7a6e16c4adb12641027","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.2-main.e7bd39d_1643835704877_0.2870665761779252","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.2-main.1916627":{"name":"json-ptr","version":"3.0.2-main.1916627","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.2-main.1916627","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"562c6bc17007464f323c0bf659559c43a3b448de","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.2-main.1916627.tgz","fileCount":17,"integrity":"sha512-rWDS9mwvVLt5Qi5wIxv/IRd0QtQ9Ull1RgvDMHzdVFcTcXBn87+GVxiDSeTRV1RQ/LslQT3/VoIUsJQmBJZ7QA==","signatures":[{"sig":"MEUCIQCjZ4gRiHYT5TNBSG4mfmOkuMUGNZUqMMFlmYGV/aCSogIgcESp3zjPCGVlS3YAzFJ8853GQhn1Ugm+xrNkl4iHhcY=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1542616,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+vh6CRA9TVsSAnZWagAAZJ0P/11Wqu+0E7edXh4txgkT\nPqT7sHc5/4XQ0DmWfvMcSNtv1il5ms3FhEapl7yMDF1iFyGkLy0wOy7UrdbZ\nxJBu7eHpzrDlwAbf02WS5sjKQNqnHa+9tnv5T6a7NNbPRiOTNNIl2hzai4LU\nuoojRQSsrmYF/1UXU6VoGl+73DNqakg+QSAG+5Wh0csCwMMQPd/H6iYirfBb\n5gc9YDuEZDFEW88WWSSAjZcWTecPWXbsjloA5HgLIpiHZWMcgccNqP6xmc34\nUvZbVt++XvyGxN1qhDY0VJrvjiSMChFy7d5S7oasj/s6prB7wAocP/KnCBoV\nKQwVfl2cH3b6cVVKXnrYSh0/UcAM9E3MdoQQ2+jgchlUORKU4LoKa8hb6gxs\nvYT9kdWhycsu9wT/MGZHUtaEAewLwRqAEbpVoL3F8RR+VxPHYnmQSgol6790\ntfOOX81FWBhvGRfdrtJLWA0jyX//3JSMb5zhW5SS7lT9DyEDAyxowtBbjiQJ\nsF+cys7kWmF4vn/mdeZEq8Qg7sJrVRMj5XoyHraDLUr0Q1Mxnsmez0PKoqAX\nxOdjt38TxW7Xm3/i/VEYyvVIk/Oy8uDJGVyu8I54CCF/MP4ckwaobLhGgsWH\ns6UhakpnOb7EOWJpzpWbrf/0ROSAmfkJWNScTqLmsVo1jOSPgXAFTo62vWOc\nGiMY\r\n=GhL7\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/master.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/master) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/master/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](http://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"191662755c77220c53159ef135d46c2f02306d3f","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.2-main.1916627_1643837562466_0.5515004676094093","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.0.2-main.78e4a61":{"name":"json-ptr","version":"3.0.2-main.78e4a61","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.0.2-main.78e4a61","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"38d21861618941ba3b55cc4112bdbdb0d46c9b60","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.0.2-main.78e4a61.tgz","fileCount":17,"integrity":"sha512-lRM8vLnjsRQkjj46RgTh5rgjdIHsD2h2Yr9t+AvFQgZ6lCc1fQG3XKqMtQvQD2oAwcp0bEWW7HiStEtfdmlh6w==","signatures":[{"sig":"MEUCIFIghssK88sKTtIJbbZ5b1bqtdH39F3T5bg6R/yZc9NjAiEA/c8EJoscjwbua4wBycENVdjI4vajhX5u1Y+LNbHFhQE=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1542611,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+vk+CRA9TVsSAnZWagAAbUUP/iviKBmjMuVrWzy8Bs1s\nSQ4CqkA038CavFpVjy7aD8QG5VY3/BRo7T8x68pHrltKUCtGRzOrUjjuCVUL\n6COCKAocmZFp8nhgH2Oq1TibW0MGarJ//CNxoPCOEnJxhdL/RHJRvp6NflwE\nYxggWUZZdCaDlz6pAfYA1nqpQ80p/PDWbNG6FeAJVTkXPBFKIgjoyYqzQGye\n4+hz7XMIa0oG46qOtwnl2e52Sa9zBJlke4bcCRBzslWG8jVDpQ+Zl9SHnqVM\nrr/2WeMTVp2LZ1GXoGhncb1SfoCKI42LjDyDT4HJDejBhOSR9wBguNo6pLA3\nUCUFAFCNxI7mEivjPlfeuB6P2EdDJLxFp59gEjWU7UUsn0j901wuvoAcgW5j\nWEIPEsPd0BHFcaNJmp3GAvOywVRhQEuVq2hXJboILm6g4SxfpXXsjWm1YWf3\nHMQE76Llwa+DRRhW18DyF7+oF4jAk8MniSAoUYWYvmx/WY1tRGNe3RNZvrn1\nWVBtjQCOO1Zp4HuLO8wJznT7ZnTexBGvpsKmv2v2S75lVYgksdkzRFbTaeWt\nDSUl8iPngUuGyOBvl+tK6RL7xaPle+AqKk09w+M/tdkNDtorDYzz4oZdRx9E\n3trpGtdG+dx5VCdwYuHZi2VQFts7bm8dJPF9KZLkWdmIZtT5Pl0b8J7k7v+W\nB8ID\r\n=6Vs1\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/main.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/main) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/main/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.0.2/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](https://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"78e4a615a986ba9f21fae12526697692a605f7b5","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.0.2-main.78e4a61_1643837758263_0.4431113707108245","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.0":{"name":"json-ptr","version":"3.1.0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.0","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"374f5122716d555226f5675ae097ac115a0efc64","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.0.tgz","fileCount":17,"integrity":"sha512-KMsG905wFbHHTnvd66MHCNo0E43UPalKt2zQUbBtWrDYKk/3vE/4u8lfWDdIyPEoMXxOFJO1lsBs6xPBXKxeVw==","signatures":[{"sig":"MEYCIQDM7d+ppfEvpStC1Vcy89khckhx9zCHjlavBcpGcYQutAIhAMPJNAcwv8pRbMp3pxlfR6Ud4eXChP1MDkPXCpuguIeO","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1543182,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+v06CRA9TVsSAnZWagAAIpwP/3N2UNMPh/RC9G1oOFWO\nBNfRWVUCd82/nWRmA2d+Rqem9bip74KwBCyJoNunr1n5r2raDfhW23AcwLbD\nNq67rq81KYSbzbN6R3DtzeYDbLuUbyDYuXnMiH45jbbJDLR9l5KzjWPYPKAf\n2y2E0tdUNLLSW/cJc3RPMtoEm2i0DZkZq70qQOI05sjUXe365fEUkLLo/DE2\nPK1GPgBZiLljIVkfA1J5J+BdRqerSrU/0VHBeX6IBPY/NeUCyJmkxlX+Lv84\nBghejqS/Z/+kj4dtM0qX0goi7oJNwAS4gOUV7UXjMWpp+wuZWKWG0001dj7h\n4Le4qY8Yd/vF5QJnMiqoZkijbhVtsQLXF+goZNFOhTzLKUGRTWOKn2EcUpqv\nCxJuWTdK5cMfGbvN8S3Ymg0FL8KjWjajye62oKttFkdH155HJOv7Aal46UXT\npvPGmO3fXCuFzcuZx7BHVkEbzZuoYLkT7wr483ZTV1mI6aXhFiWtEVFhe7gk\noa22H7AZ5WH4xSW2Ata2TTcvhGWQtKhzTJpPGUwpWAlqR4bV5HIobTdDiuz4\nL1JOqWEdtR2pioro5L4177loV2z3B1k6YpbDzse6YyZ5M4xrGbJx0Q8KNW5j\n0Kma1c+EAOHhJGc1F+7rBCsusMWzPRnHVG6JfhPKD1g8pbFCyemjT5cdz+aF\nmyVU\r\n=0naX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"02aa710da1b426d03ae045ba6be832a6685f2af5","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.0_1643838778328_0.21952492346178376","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.1-main.02aa710":{"name":"json-ptr","version":"3.1.1-main.02aa710","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.1-main.02aa710","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"cf7526aabd40de1bb0ced53403a9e24941ef6447","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.1-main.02aa710.tgz","fileCount":17,"integrity":"sha512-kVBvHyUeb9mMMxE6JnmIvXKa1g+BiJhvK3coVJVNzFkpzTMMbZK5FrJcxLFKIL5fye/C9x9mq/z5Dmf/HOWEBg==","signatures":[{"sig":"MEUCIQCedzSCf7FVUpqysHXrB1RhAeiZnKFwLJsJLJCaX4wDGwIgIVxfrIxiAh5XvPaVeP7Q1op9/71JCsm0x1DmECy2nmo=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1543195,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+v09CRA9TVsSAnZWagAAKPwQAIhtYXAp8WeFALJN7oCa\nzWIfECtFeQZdv1mUAzACK2axPXpt6iP4YMZ07XMUHPpGIYz8Fr6otGcpleUl\nBHuSkR0Uyfj9rT84//m5CKu8kuV91BmFr/IlOvuBk2flRVMljxiOwlNnTPLS\npyW4s2m2iYwpeM3AUp8Dsw9m8iGJ6GPssRuWvAqN5EiCrUQt/YxijCdU88/F\nvVvpR2MtmeOPadcfGyCPxPIkjdJEhUL3PasMnvADluTTopmnC92cW6I7Kwj0\n1FRwIGlRcrTPwvmZvnC74CKqa/x/G99ANRTfongPzicwikDI8aA4dc7t+Bpm\nCoSJABBY3Lu16UyJajQApjXKCfbDWJuFIB1t5r3Yuq6OuZPBZAUbU4jBAq3Z\n1jFWKfAVyLcQpqJXhc6NSO1tVSiJvoIskq7ZThMp9bW+9bO0WXGZxod5DmNz\nTYHBS00B78bjB2K+4heUMwBx8Cl22fpq+fUSj8VTHjg865458ZPeAhh7D0Px\nnUVfVLieqop/jZG8bk9Mvm8VTAXSgNQ7DCQfmeCAjEP9F6tll+0ZzxTnUtVV\nuabBAyCP0y39vKeZxLf6hcfGM7BrTBc3ybnkQeRZKthqgoLXE/cGnZSRm7vp\ng/m0jIIh3zQpGrfXn0AiYSEx/R7NnKNVmaIwF7IkM6VIODC7xQ0b9HkRY3Vj\nA26T\r\n=5c+u\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/main.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/main) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/main/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.1.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](https://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2022-02-02 — **3.1.0**\n\n  - [fixed issue #48](https://github.com/flitbit/json-ptr/issues/48) wherein, when calling any of the `.set()` methods, which in turn rely on [`setValueAtPath()`](https://flitbit.github.io/json-ptr/modules.html#setValueAtPath), _and_ using the `force` argument to enable creating an object graph, one character path segments were interpreted as numbers, which resulted in unintended object graphs being created when the character was not an integer.\n  - fixed borked documentation as reported in [issue #44](https://github.com/flitbit/json-ptr/issues/44)\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"02aa710da1b426d03ae045ba6be832a6685f2af5","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.1-main.02aa710_1643838781141_0.8872558829639472","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.1-fix-examples.80a275d":{"name":"json-ptr","version":"3.1.1-fix-examples.80a275d","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.1-fix-examples.80a275d","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"e2797f847d25d96e812d8d696593d3e35d455752","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.1-fix-examples.80a275d.tgz","fileCount":17,"integrity":"sha512-Xw5/FyyWqQnQnsHepGpD3Tg9mYfN0/VrVK1uQCuImFWN0lI5kuTWx/7Ky4Im+6LrqaX2ER7l3nFgTCw8KJykRQ==","signatures":[{"sig":"MEQCIHyX6h/hg/gD64SvHkhYlnw4cD4kDmO9MsN0Zb3CIHRYAiAP8Zf6onb3BgEgOi/9i8PnClnW8tP6PsGAh1qxj6ZKog==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1543203,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/DThCRA9TVsSAnZWagAADG4P/2tDE52ICeJrOzu62DiW\nrZZptc+XR3Yq1C3mxHXAwG1iu2JRJQsvP6GDdRF82diS5DLbknwSHWi4T7Yn\nNusE9adDyaQkTAfUlgyk4BEY1Q0LVvSNGOk/yqmBmtUUf0W7+vRsjWNMWbN8\nuGXYJIQQQXEGKfYsdpGaC3yzexYvkYE29I3Ry+gqWEaEej7XA8uL5SmN5ofy\nAemQewi9xKmyCacLZEdjeJpFAKHbVbiGDBVDKDURy6fdL5L4yPgr53RxNMTo\np3GVnc6APt2lJdynl0hNKkA9E7E1HivLtQ8wcDGDVUiW8iu8P7GFLCpVI/Fn\nzBMcS0akN5VZriMWmjvDHPCWiWG9mspkkdARvLLD73UNzNrnJyH1eT3z0fTe\nf70OstL+jwDbCEA1uOZiZd2kicJqDRFqFUjeovLuG8+qkgw3Oz9Mq/e2O16D\naJKl4x4Wvq/n6CL/kBB0KGVAVt7p5DAapBvJSXLiXcwO91R6h26nSW6Ol1Zb\n0qQrOZfvJEuUUaaNuF8iEBe92FHL7OBMqZDRfFQNDcqQOpC7uT7JK5ESvb36\niafU0U6WKQC1L5ruLhWgfn/4CQ9UkzGOoBSW2n6biBShE4S+cyS8hTt/jX54\n3qkiZRUHumJ50XHcsEwCKHQ7mB61FwMZU2E6g13g0FWJ/7OmJcFymtt0Envd\nLcwB\r\n=HrVy\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/main.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/main) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/main/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.1.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](https://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2022-02-02 — **3.1.0**\n\n  - [fixed issue #48](https://github.com/flitbit/json-ptr/issues/48) wherein, when calling any of the `.set()` methods, which in turn rely on [`setValueAtPath()`](https://flitbit.github.io/json-ptr/modules.html#setValueAtPath), _and_ using the `force` argument to enable creating an object graph, one character path segments were interpreted as numbers, which resulted in unintended object graphs being created when the character was not an integer.\n  - fixed borked documentation as reported in [issue #44](https://github.com/flitbit/json-ptr/issues/44)\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"80a275d199b7a8efbfcf2f8cbfa1142188534305","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.1-fix-examples.80a275d_1643918560786_0.010911535403109962","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.1-main.677a678":{"name":"json-ptr","version":"3.1.1-main.677a678","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.1-main.677a678","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"74fddff32293f5001097d78dc2d125608acd6fbb","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.1-main.677a678.tgz","fileCount":17,"integrity":"sha512-TaTVREUNMGAhZQySBZPKyJNOGDSthivH8icmYkULu3FBAXX0k6JeVKTPK8367vV5TopxPovd2/kABMxsbEmaHQ==","signatures":[{"sig":"MEUCIQCVIjZsPgAD+RTPhYPzCqmyMdEFmU+PSC/TefZ0pfvTXwIgZMSnKhzh2jd6DKpbNEqucpJj+DnsirSmGXdBGY8O8o8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1543195,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/DZ9CRA9TVsSAnZWagAAPcIP/0o8oIatv36prRl/WdJ3\n/Hb4GUzZqhfYFlsVoL2dhvCaAu5gF6Q9l7qbjQ1Xn2HVhpgZGShCCSBZImFB\n2tGqNYTg6eSg+gdL2iRzgDgdxooAIhIZhq1egyikzl4DYtqkKzLM6YVOkrtA\nrTEf1TYpynpC3tgUiect9w+fyxM8h2n5IceqiVDc58JLiMtyYein6vIGYnNw\nLeQJZfrH5H05NOEDxB5qVbVLJduh9/igX/FynH5rcLnhvelOmRavNyCaWfi+\nAwtDXtAAbtZTNCfg1OtkyXt+Ficu9Bk/icvKf1dspwAfohb52T9xX8/LJjOW\nvRyC0NGQbP0OGNFdXiyFH+B7vX46r53VDVqQpJTPKmFFJ5fbGCWGJ1euwPFR\nI/UHN9h/f128B9oyTe8U9sl6RdTZGI1C3+ybbMyAmkY5mjDosBY5k4doZSqE\nUUfV4HbFsXWY1LLQmKod+QQQVHQZUm+t+881EesSroaEjh59nwshAFMnuzuc\nwvTR2NCttoc+AkPSfzUrWF/iM6/Dx8IkP2rfhay4L4W76eSEDRBAlexYUDvH\nyPOjBuk+ipbXj5AuNbVJTwfF1ahfGUgjk1paQOJAp48p5nbysKRIkmkw6le3\nXF0fheLkhNYV9hz5GNL8QxqO0B8wOQrVav6MChYa1EOz2q8VSPap3h6iEI3w\nAMm5\r\n=yt3+\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/main.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/main) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/main/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.1.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](https://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2022-02-02 — **3.1.0**\n\n  - [fixed issue #48](https://github.com/flitbit/json-ptr/issues/48) wherein, when calling any of the `.set()` methods, which in turn rely on [`setValueAtPath()`](https://flitbit.github.io/json-ptr/modules.html#setValueAtPath), _and_ using the `force` argument to enable creating an object graph, one character path segments were interpreted as numbers, which resulted in unintended object graphs being created when the character was not an integer.\n  - fixed borked documentation as reported in [issue #44](https://github.com/flitbit/json-ptr/issues/44)\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"677a6782759be99864db40574a9d349bb510a919","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.1-main.677a678_1643918973542_0.20523024375641596","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.1-symbols.0e6db58":{"name":"json-ptr","version":"3.1.1-symbols.0e6db58","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.1-symbols.0e6db58","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"e2120c450be109fde0baab2b5315236332069e6a","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.1-symbols.0e6db58.tgz","fileCount":17,"integrity":"sha512-sLAknyjVZIKezWhqoDAqR984e15IwoUyGMRSngbJSGwC9Mj4cXig9lFJVjXuZdynSH1KIJrn56KhepOmLFuLag==","signatures":[{"sig":"MEUCIErVMisf97g8ku2g8D6taYtimHFMBlc+vx7wDTz5C1tDAiEA7l3Tft0QKvPhXrlboDE1wRE5Ha7LqkmrwjJscumZSIs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1634273,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh/aaSCRA9TVsSAnZWagAAl0IP/3joW8AfUnt4AppP0L6o\nZfN1G1w6QEHW6ThVbH9pQkjmZXV2FMuhyZPlvNCqGpQf4N5LGxnpLtO76ZZO\n5bUn3UXjoHxsUksj5UkI08JeY0sprYoDuAd2ONoqMPCeCY4WrLwGICxg1gU7\nI0xwebt4rKnZeyNsJz4+F9sZryKlLoc3utScf7wR60FpTZbWoTXy6/TjikQb\nSDEYUIR/MRhIlei8YASW7Vat6sugLKitfZ1rF0/fjIj2qPqpGffRY+LlUgjH\nTGoLOmjhqVbYq47dBSANBSV4Ch6A52Y9FztTyYBRn8sEDOmOkJAMHJ8q3gtM\nDK3uZ0BmWN+GJg82Eg2nppGI/ygsy15bhiYQ0lHcNl25ymI2/UOwnsbJCKzT\nZYWNkRDxyf3LlIqjcJD1mwpbKFEQJxj6Bm0YwJFKOFXlBARKLxIiMGUs3oOX\nN/SBKgRCxOMnNuWLPUL8eKiSNLoovGaSGSxyfKHZT9pQVe4cgjAi1bae92OA\ni3Q8Yr7UudDXijpGqqgCXJNDN/2ZYvNiPyRGcfTulOagveYEaX+9zOwWMLEX\nHVN0e4THQw53KJzGZfkNkLJEsYl5N85uanqxfKJ+oaiupUGYYxyKKkC99OdZ\nAcXcDR+ol3Q1oFhEjwjEbjEU7d4PlwuExmFa891AHCVLMa8+Vz/gm3vzhlfp\n1MDa\r\n=SaZ8\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/main.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/main) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/main/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.1.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](https://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2022-02-02 — **3.1.0**\n\n  - [fixed issue #48](https://github.com/flitbit/json-ptr/issues/48) wherein, when calling any of the `.set()` methods, which in turn rely on [`setValueAtPath()`](https://flitbit.github.io/json-ptr/modules.html#setValueAtPath), _and_ using the `force` argument to enable creating an object graph, one character path segments were interpreted as numbers, which resulted in unintended object graphs being created when the character was not an integer.\n  - fixed borked documentation as reported in [issue #44](https://github.com/flitbit/json-ptr/issues/44)\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"0e6db58e43c72582fcf5db316f433c3522f17658","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.1-symbols.0e6db58_1644013202500_0.056801074417131","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.1-dependabot-npm-and-yarn-minimist-1-2-6.98d2cb6":{"name":"json-ptr","version":"3.1.1-dependabot-npm-and-yarn-minimist-1-2-6.98d2cb6","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.1-dependabot-npm-and-yarn-minimist-1-2-6.98d2cb6","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"b8e55c825cd3dc99db368274544ae952a4ea76b3","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.1-dependabot-npm-and-yarn-minimist-1-2-6.98d2cb6.tgz","fileCount":17,"integrity":"sha512-ZT+ThsqjpaMAD3UaujvhMF8Qu1DSaHsolqeqFG7IpC9AIp5ELEM9UxqXEv23uTsolPqVNKs6W5fcZZAI8L5PdQ==","signatures":[{"sig":"MEUCIGCkt1DqXoxl6xRF6FJEOT/WjcfejDbdh9rMAekHb2MAAiEA+FbBWBejQ6IxObRZ5vrGVZ5JAxh1TBtFI7O8kJnP+ks=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1543229,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiUQkyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqqEg/9Gm+08VMI+e1C+VUJdOZHeGru4mPOEkrB2epcZlIGpK38eBPh\r\nYMm186v8WAkgyNni71gG3UqUnEgrqvjHnHizRLuN2Pmjc4U9rcbksmMizpeM\r\nMc+it+clc66qjxxCzaZEctIPmKZUR0lFrLtW4V3BXxjZZhSqTrDLTlDvoOiV\r\nefhIHfFqQCdCVEJ3QmeLFB3hxvLdsTXbqMd5irRWTw3RqOrBXWdZdggUs4sG\r\n4bhbSx5WY4nhSlwYK9NfODf/3trOo+7mBk/61MF6opvSFIb8wtQTZANaw6CM\r\nUuc91LXiyX9Aci+Zru0MJZjVItqeMnLg/tODnPBsIpd1hJo6dFr7fHfHQQO5\r\nOeMx8vvGwcs8ix4KBaK6AFvZLEy2fHMHNJK4qIineH6NxSgZf1iF7NmUqbAr\r\n+/9GnRLS0lOpU66z6QgwZJsWe1KZVtc+pI7eY9DN8zhhM4/7uLM8b9rzqkEq\r\nEeshPFpg+XX0J09xjAVPQGUNF1h+NM4VwZBPNXTxt7K3IvsVUrHr7o8xuVPA\r\nwON7zw/68Zbm98JL9A0Hvy+thixzII0yhpVZvZI55IQFt2DyqrKJauLnuWtC\r\ncMvaMc388dSOefdjH88T/HcDgjFuevVsyJeQQ7aOD1XhBmbhHsvqYDlK6bvR\r\nTQbavECcD6hceYqfoM7I3qJdH4JrF6Xj0OI=\r\n=CCYK\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/main.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/main) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/main/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.1.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](https://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2022-02-02 — **3.1.0**\n\n  - [fixed issue #48](https://github.com/flitbit/json-ptr/issues/48) wherein, when calling any of the `.set()` methods, which in turn rely on [`setValueAtPath()`](https://flitbit.github.io/json-ptr/modules.html#setValueAtPath), _and_ using the `force` argument to enable creating an object graph, one character path segments were interpreted as numbers, which resulted in unintended object graphs being created when the character was not an integer.\n  - fixed borked documentation as reported in [issue #44](https://github.com/flitbit/json-ptr/issues/44)\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"98d2cb69762e2fe481b9d04e7db452b9ab1bcab5","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.1-dependabot-npm-and-yarn-minimist-1-2-6.98d2cb6_1649477937700_0.5143084757169774","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.1-main.3292abf":{"name":"json-ptr","version":"3.1.1-main.3292abf","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.1-main.3292abf","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"1f4c075a57e86b2eff4861a5d0e318cdf66f248c","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.1-main.3292abf.tgz","fileCount":17,"integrity":"sha512-i/SvT2FkDfsfTeZxzkXvfPooTs55Y97Jzzcf/HPCLy0023E3jc1Eo8U6xTX1f8gGma2d3Lw/7JKLbJbh+krvdw==","signatures":[{"sig":"MEQCIHxNVA7R8fq3+k2lVCFkTfH6EZpx6YTQAXeinhJe/AS2AiAQLx1zuXjFBRMLeFCKVWZ5npq1MtNQgcJirm0K+m2/Fg==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1543237,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJizgvpACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmorGw//RrabQlBjYmXHhMghy9zi/0/TBBBtwmKtSuya1ydaSnvSRqJA\r\nYNpLrkOhFuclK7WSr+l+0UG6wQI3gAbHCqe84zXWZeMrxh1zbyN7qjUnVjAc\r\nbq455XVWp3nuAIhIgZ0k44EQzhsHIvDi6sfUS7hyElbpz2VEJd0gp188UBYG\r\nHhF51RXjOLuiZdX6TYkTkTa5G39TtyqMfkWpzC16IIfXLgTmqR7eVGxBAOGh\r\nShQoGb2VRrF3w48S/jySirWdQNCiXUe7WxRaHmpMdY1L8cq1101d+hV+UQZS\r\nXEgWbtAM4vG86IVJeCBgs+nPKL0KeJ1WqZRtCsmjrWw9hWc7vBLnZbfrfiRU\r\nogQjq7JgAH4rLQbJf1/YLWpnu42VDuvRgNZWcVLza8+PgUDNqwnbvHC6CvrH\r\n4Xrxgu5n/aPAwMsu5FTaCIc8DiHj17jg9av5A7dB3ExCaJh+A4n8deoEwff1\r\nDkrObXPwU8dbee9Yu8oDFoeZc3yJaAoKOBNzgC5vjRB/rZJ1ftH9HXFgcxKv\r\nQ8c85Uum5WKZ3JhnbdtSfWC+8CGCcbofEyzo7fB9F1FA9aAZmukytonqyrIo\r\nO8mcm+ETly3QcahwqSoqMUYdEzBPmnga8XQXrKF0hcYycG8Fvd6uFUdyOJPf\r\nBX9ye4XKnBMBWc/Tjs+5WyEjeSuvRm3yJ6E=\r\n=jMUE\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/main.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/main) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/main/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.1.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](https://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2022-02-02 — **3.1.0**\n\n  - [fixed issue #48](https://github.com/flitbit/json-ptr/issues/48) wherein, when calling any of the `.set()` methods, which in turn rely on [`setValueAtPath()`](https://flitbit.github.io/json-ptr/modules.html#setValueAtPath), _and_ using the `force` argument to enable creating an object graph, one character path segments were interpreted as numbers, which resulted in unintended object graphs being created when the character was not an integer.\n  - fixed borked documentation as reported in [issue #44](https://github.com/flitbit/json-ptr/issues/44)\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"3292abf26806b9d9ca6b12320fc2b7d86b6089be","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.1-main.3292abf_1657670633218_0.3387984250773608","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.2-main.1988f05":{"name":"json-ptr","version":"3.1.2-main.1988f05","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.2-main.1988f05","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"b9818917f817d2117576dcacf9d5acbfafcc4206","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.2-main.1988f05.tgz","fileCount":17,"integrity":"sha512-SqKyIoKVnb92MWjQCm/o8eCplMAmcH/J0BcYeW6zCJckyNSwiGZUHFy4kKbSiAyPCHWVDtp2r3eAsX9PMuMc6A==","signatures":[{"sig":"MEUCIB0iMp9bKw5bFzXvczqbQrp7rL0QfNGCtVnNqisgCCP6AiEA8J5nnNeGtN8LWcz9rhPLI3WNhEbEgkv7QpvZaFHje0c=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1543237,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJizg1/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoriQ//UVY4JAu/JAyVPxegGPd0blYo5ljtjK4VUOi8CkdVmaZr1kbM\r\nw5qlnoAdq10JpVbDcpa2TS1MtHHjwVrUUlTviV1lTcWvSFfxA5yMgQMB77xf\r\nn3vRQHMYIlqvAvmEz6thduN1r2+vUgH7svvD4svw3Gn5yzuVpeRmcHIF9KVM\r\n3gG4Mf8AYUEB2vs9UmCktbqjX9r69dXFkl9MYeboB8sWphjcg4zW31bxDvGg\r\nW8qZ59eC2/7L1VDViYWt+s20usAwO798vuoZiHiFy2Z/KZ2iEoE5/jgXkUDy\r\nMVFkhZxYvA0W1U233X+Wolx4SqUCIVtGtw7221JtbJfUj/pUOIJB7Z2UVAye\r\nU60lrAGYCSA9ogYuShAi1/Jwi53LcaflDUEAPo2EDM8mII2l8B8nOLA5u8AQ\r\nr2hb6kFtdAt53LRPg9w1EjFajoB8YqmF/Kz/oG5RW4iNpsmETZQ3otCXC8D0\r\nSu2HyB1CVb8mXf2JICV56/jOLKmpcPOXpO7c8whDQugQ/5Ir+JzUdwMaW5GF\r\nI+c38tK6GQ0CIrhC9AOrXVh2lu4It1TYaSFvcIO8AoFspb0WiECjla8+QiRh\r\ngiyixVE4fOIYwLBQSXklzPzWyhR34RUFL5gJjGLazwmp3fBKgmE0rZxX8QXh\r\n2DJimGw8NYwF3da7FLoyoRgjg/ZjJIxOOE8=\r\n=gse/\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/main.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/main) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/main/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.1.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](https://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2022-02-02 — **3.1.0**\n\n  - [fixed issue #48](https://github.com/flitbit/json-ptr/issues/48) wherein, when calling any of the `.set()` methods, which in turn rely on [`setValueAtPath()`](https://flitbit.github.io/json-ptr/modules.html#setValueAtPath), _and_ using the `force` argument to enable creating an object graph, one character path segments were interpreted as numbers, which resulted in unintended object graphs being created when the character was not an integer.\n  - fixed borked documentation as reported in [issue #44](https://github.com/flitbit/json-ptr/issues/44)\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"1988f0582be565610f3f706e6aae865586d9314a","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.2-main.1988f05_1657671038839_0.8542841844804672","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.1":{"name":"json-ptr","version":"3.1.1","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.1","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"184c3d48db659fa9bbc1519f7db6f390ddffb659","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.1.tgz","fileCount":17,"integrity":"sha512-SiSJQ805W1sDUCD1+/t1/1BIrveq2Fe9HJqENxZmMCILmrPI7WhS/pePpIOx85v6/H2z1Vy7AI08GV2TzfXocg==","signatures":[{"sig":"MEYCIQD31AOnlHb1Ui65+Rj4mYNdab8lL4b55UmjIxEYytFtXQIhAKYMvgccbf7ihPEOG8D0CqNzuzwZ1N7eI8G6jzKnggtA","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1543224,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJizg2PACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrVhg//UIGIfgwMdoWCGU6v77SmcyJ8PMvMjQM+vY2RNjgLJEIPtLMs\r\np293sXP/f/UaUgALUurURPhUzze61i4yZyNNoHNGNa14rix+bQZuSp9mAU3i\r\n/xbaF+PuXQN6B6/h2oOS55CY3aNFPNi196Fgg2ldFb9tqmpjVZ8JnmGgkwbb\r\nYkuh96vLA3C+RaYHhlZM5ISCR9Vm9iJqS6Ckfku7Zwm/K0NC7uFtBbYswBcs\r\nRgJ7sPsKzVrpDpNlR0+bhvBcMdn87uaE/ia2Hmb+Tux1NxmiSYiRc6Kpd04F\r\n13YchrFPAB+ITWRvisyM3vqJ3ZaWhrs59lhAAvxq+Q4Ct/REUB5feB8G6Kps\r\nqugr/ezvKAIL+RVWw2HsSC8nS1yoSXLSRixIqCx4TFlzBjpO8xhBs/G0AsZ+\r\nt5NYdbniYOvdW0vyVgsioaw0DADYxhPVqexAyV767ZqJrJ6loaHNigFrcLWS\r\n5UcZwmKAo+bpo59A54acXR+ObItuusZwi38T6a0osyG3UOrY92OgMhR2bQrD\r\nTsp0F/EZhF9BgnH74lHUXYZfj66dggAYU8wkkDgi7nWt6wTyAG0vFsfTcVXG\r\niyFVrq0HOEPXvaJ2R5K6p9OBssodyyLKi3eaeLRYYFlhjzVK0MFh3+nmBi+f\r\nJKN0+AShVnfcnptJLdcrL+QuQ9YvcGaBLME=\r\n=8gyD\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"1988f0582be565610f3f706e6aae865586d9314a","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.1_1657671055178_0.4918980853999608","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.2-dependabot-npm-and-yarn-json5-2-2-3.c209166":{"name":"json-ptr","version":"3.1.2-dependabot-npm-and-yarn-json5-2-2-3.c209166","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.2-dependabot-npm-and-yarn-json5-2-2-3.c209166","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"441a4a0e515c6a21a1e64b78d439fb754bf88e6e","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.2-dependabot-npm-and-yarn-json5-2-2-3.c209166.tgz","fileCount":17,"integrity":"sha512-oDWaKqBUmqX8ECgsmbaUAT+5yQVWflWBcGgkp8XjTufQ8UxrvdMTBKrwsERSNtg4czeYqpVmKWHuQBXkJxY52Q==","signatures":[{"sig":"MEYCIQD91LPjxfLsnAjTMXAIcFdpaceFjaDyin1eUxdp9vR0WAIhAOmff9yhRHcY5Vi7rdsc5zBFRCPhV09zuD2NFJwhImBF","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1543268,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjuPnhACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmocdhAAgEIK2j8vFliKummz4t18HqfG79eMgMqB3EhNLqeZRGudlg3c\r\nKvXKoqGhSd+fVDQAumHAXwQWQzctOh2A7nQ3WXg3Dc5YEUdVZ0LLlOyGKHTA\r\nuc8fFrOr96/2hn53qHnISVRTp7TIVBSlkY1OrLSV2pBjqvz7AyzEfYdrpVAH\r\nlbEe9o2ZzuYPC5M3dSmHw2StAiPsvlcGdkcJjEUkhyDvrVqPax27iwUgM0n0\r\n3QQQBp9I+lXamnGqmtQtK2ZyQxnP/YehUlaVFxWaJ5c1iEiJtGnGP8CMgDZl\r\nM7yxkKoBvhWs0gLS9pA1KakMQU1bgVfrD816LG7Duqb8myMHvtc6NAXJhGLb\r\nzG+y+MimCqls+eQ5yIp55i2UPxdMlBGkrnMGL5fRubsDEb5NQ2+q2fjvsTGx\r\nSzEx1uRB7MiwuPJYZI4UtEfKHD1VT27Ali+A5hY5HQ+1RX57Gu4+QHTqLviu\r\ns/UR4tdeX8ynnSfsp/2pZ0+z7TqiYTHnARiKZ47KV3fDXkN2JvxLD4YAwyVV\r\nG4LMeF+V9GC1+YzMfUQF1XwMSJTjO2FCZl6j3F/Xu2hWG4xUN2YsRcxQeORk\r\nQGImVXroawX50VSjCb8eNk+Y6M3Tr20Gd7g7kALNAYFpzNcBsDVmDZNuDqQa\r\n0fb16lwcA4UwBy0oMK+7aWdRxiAXgPlMnXQ=\r\n=ypFX\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/main.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/main) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/main/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.1.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](https://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2022-02-02 — **3.1.0**\n\n  - [fixed issue #48](https://github.com/flitbit/json-ptr/issues/48) wherein, when calling any of the `.set()` methods, which in turn rely on [`setValueAtPath()`](https://flitbit.github.io/json-ptr/modules.html#setValueAtPath), _and_ using the `force` argument to enable creating an object graph, one character path segments were interpreted as numbers, which resulted in unintended object graphs being created when the character was not an integer.\n  - fixed borked documentation as reported in [issue #44](https://github.com/flitbit/json-ptr/issues/44)\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"c209166973314b00226c73a0deb8e31cbf127808","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.2-dependabot-npm-and-yarn-json5-2-2-3.c209166_1673066977250_0.21867888786785117","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."},"3.1.2-dependabot-npm-and-yarn-webpack-5-76-0.29bfad0":{"name":"json-ptr","version":"3.1.2-dependabot-npm-and-yarn-webpack-5-76-0.29bfad0","keywords":["6901","json","pointers","fragmentid"],"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","_id":"json-ptr@3.1.2-dependabot-npm-and-yarn-webpack-5-76-0.29bfad0","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"homepage":"https://github.com/flitbit/json-ptr#readme","bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"umd":"dist/json-ptr.min.js","dist":{"shasum":"248156f994efb978a351fe99a6fd04467c91d65a","tarball":"https://registry.npmjs.org/json-ptr/-/json-ptr-3.1.2-dependabot-npm-and-yarn-webpack-5-76-0.29bfad0.tgz","fileCount":17,"integrity":"sha512-B8NJPNBC/s3I1Wl8wK7pNzi7X6ean4ssYTaTRYezZZ5SfgAWDQT4rqwOc71WahaOzB/LXKabQV9+QymiV5vTBA==","signatures":[{"sig":"MEUCIBI60CxIL7ZSYVB+OWalzaDPzhE5Korw0qDD6jXeWiYeAiEA6BpHAqUxqaw80PxtojGG3Ngh3TRKjA8y99rVJtZZnOw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1543247,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkEPa4ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqjsw/+Nq8tgUQoH7Fg0MdQ6Ma7tz+GIxhGsGQQbRdmufQrq5gEW3py\r\nA8YI3XEbyy9vnqG05D/ubH+92sv+li5rUX1c8qjMSO6YfpfrDDwKKLVwrti5\r\nng6nBjOsQQmCyPqIhZIdqbw69vSAozaeGeTSIZNaZwq8rOrmA7xIIbnae7eR\r\nsujk9qtMuOEUdPTXNqQqps5BAgGa19RFcp3mBQOlgsAUD9XyZem9Rpp7gzwy\r\nLen25AOOai5zoSWHatKGFAxSj0FgdS8TaY2Bja5wUspOCYa0pQpd2obCF/Mk\r\niDfzMuZofQ4diBfFb40PbiS2ucxAVG3gDV1yxT7Zn147x0EdzXc7SXKSJRGt\r\n8DFDRnsoq/d1zewAtL5otXn5al7Txw9ZEEP+9pxkSjgVGwhNz83scHjwHiC0\r\nOOtI25PI7i7LMthn9Edp52y4lytALRZKFw0/PJ2HUgCZepxexwqKW/2qlrz6\r\n8G1hwnHi4/f5bQe8NAr7o5EO+sZnXIWKX86S7FUuJyn32Vd+4BYjVIYJiUMG\r\nKOCxQ8rCFnBpoWl0aqTmp6zpyIlxmwkPZ6Cj0RVMwJ6rHXG9DJ2SVqyZtLWu\r\ndAc532bbuxUanj4S5uoEDPHGg00FkDfxftwdhgc4eq5UKBjURdKD4qEK8ryt\r\nPljzPcGpQqHrdG2WEmIxGSEg330tlvTCiys=\r\n=FCNn\r\n-----END PGP SIGNATURE-----\r\n"},"main":"dist/cjs/index.js","types":"dist/types/index.d.ts","module":"dist/esm/index.js","readme":"# json-ptr\n\n[![CircleCI](https://circleci.com/gh/flitbit/json-ptr/tree/main.svg?style=svg)](https://circleci.com/gh/flitbit/json-ptr/tree/main) [![codecov](https://codecov.io/gh/flitbit/json-ptr/branch/main/graph/badge.svg)](https://codecov.io/gh/flitbit/json-ptr)\n\nA complete implementation of JSON Pointer ([RFC 6901](https://tools.ietf.org/html/rfc6901)) for nodejs and modern browsers.\n\nSupports [Relative JSON Pointers](https://tools.ietf.org/id/draft-handrews-relative-json-pointer-00.html). ([Example](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js))\n\n## Background\n\nI wrote this a few years back when I was unable to find a _complete implementation_ of [RFC 6901](https://tools.ietf.org/html/rfc6901). It turns out that I now use the hell out of it. I hope you also find it useful.\n\n## Install\n\n```bash\nnpm install json-ptr\n```\n\n## Release Bundles\n\nAs of v3.0.0, we provide CJS, ESM, and UMD builds under the `dist/` folder when you install the package from NPM, we also have all appropriate references in our `package.json` file, so your code should just work. If you need a CDN reference for a website or the like, try [UNPKG](https://unpkg.com/), which picks up our releases automatically.\n\nCDN: https://unpkg.com/browse/json-ptr@3.1.0/dist/json-ptr.min.js.\n\n## Use\n\nBoth CJS and ESM are supported.\n\n```javascript\nconst { JsonPointer } = require('json-ptr');\n```\n\n```javascript\nimport { JsonPointer } from 'json-ptr';\n```\n\n## API Documentation\n\nThe [API documentation is generated from code by typedoc and hosted here](https://flitbit.github.io/json-ptr/). Read the docs.\n\nDocumentation is always a work in progress, let us know by creating an issue if you need a scenario documented.\n\n### Example\n\nThere are many uses for JSON Pointers, here's one we encountered when we updated a public API and suddenly had clients sending two different message bodies to our APIs. This example is contrived to illustrate how we supported both new and old incoming messages:\n\n```ts\n// examples/versions.ts\nimport { JsonPointer } from 'json-ptr';\n\nexport type SupportedVersion = '1.0' | '1.1';\n\ninterface PrimaryGuestNamePointers {\n  name: JsonPointer;\n  surname: JsonPointer;\n  honorific: JsonPointer;\n}\nconst versions: Record<SupportedVersion, PrimaryGuestNamePointers> = {\n  '1.0': {\n    name: JsonPointer.create('/guests/0/name'),\n    surname: JsonPointer.create('/guests/0/surname'),\n    honorific: JsonPointer.create('/guests/0/honorific'),\n  },\n  '1.1': {\n    name: JsonPointer.create('/primary/primaryGuest/name'),\n    surname: JsonPointer.create('/primary/primaryGuest/surname'),\n    honorific: JsonPointer.create('/primary/primaryGuest/honorific'),\n  },\n};\n\ninterface Reservation extends Record<string, unknown> {\n  version?: SupportedVersion;\n}\n\n/**\n * Gets the primary guest's name from the specified reservation.\n * @param reservation a reservation, either version 1.0 or bearing a `version`\n * property indicating the version.\n */\nfunction primaryGuestName(reservation: Reservation): string {\n  const pointers = versions[reservation.version || '1.0'];\n  if (!pointers) {\n    throw new Error(`Unsupported reservation version: ${reservation.version}`);\n  }\n  const name = pointers.name.get(reservation) as string;\n  const surname = pointers.surname.get(reservation) as string;\n  const honorific = pointers.honorific.get(reservation) as string;\n  const names: string[] = [];\n  if (honorific) names.push(honorific);\n  if (name) names.push(name);\n  if (surname) names.push(surname);\n  return names.join(' ');\n}\n\n// The original layout of a reservation (only the parts relevant to our example)\nconst reservationV1: Reservation = {\n  guests: [\n    {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    {\n      name: 'Wanda',\n      surname: 'Finkle',\n      honorific: 'Mrs.',\n    },\n    {\n      name: 'Wilma',\n      surname: 'Finkle',\n      honorific: 'Miss',\n      child: true,\n      age: 12,\n    },\n  ],\n  // ...\n};\n\n// The new layout of a reservation (only the parts relevant to our example)\nconst reservationV1_1: Reservation = {\n  version: '1.1',\n  primary: {\n    primaryGuest: {\n      name: 'Wilbur',\n      surname: 'Finkle',\n      honorific: 'Mr.',\n    },\n    additionalGuests: [\n      {\n        name: 'Wanda',\n        surname: 'Finkle',\n        honorific: 'Mrs.',\n      },\n      {\n        name: 'Wilma',\n        surname: 'Finkle',\n        honorific: 'Miss',\n        child: true,\n        age: 12,\n      },\n    ],\n    // ...\n  },\n  // ...\n};\n\nconsole.log(primaryGuestName(reservationV1));\nconsole.log(primaryGuestName(reservationV1_1));\n```\n\n## Security Vulnerabilities (Resolved)\n\n- **prior to v3.0.0** there was a security vulnerability which allowed a developer to perform prototype pollution by sending malformed path segments to `json-ptr`. If you were one of these developers, you should upgrade to v3.0.0 immediately, and stop using `json-ptr` to pollute an object's prototype. If you feel you have a legitimate reason to do so, please use another method and leave `json-ptr` out of it. Such behavior has been disallowed since it can easily be done using plain ol javascript by those determined to violate common best practice.\n\n- **prior to v2.1.0** there was a security vulnerability which allowed an unscrupulous actor to execute arbitrary code if developers failed to sanitize user input before sending it to `json-ptr`. If your code does not sanitize user input before sending it to `json-ptr`, your project is vulnerable and you should upgrade to v3.0.0 immediately. And while your at it, start sanitized user input before sending it to any library!\n\n## Breaking Changes at v1.3.0\n\nAs was rightly pointed out in [this issue](https://github.com/flitbit/json-ptr/issues/24), I should have rolled the major version at `v1.3.0` instead of the minor version due to [breaking changes to the API](#user-content-where-did-the-global-functions-go). Not the worst blunder I've made, but my apologies all the same. Since the ship has sailed, I'm boosting the visibility of these breaking changes.\n\n### Where did the Global Functions Go?\n\nIn version `v1.3.0` of the library, global functions were moved to static functions of the `JsonPointer` class. There should be no difference in arguments or behavior. If you were previously importing the global functions it is a small change to destructure them and have compatible code.\n\n| Global Fn           | Static Fn                       | Documentation                                                                                                                                                                                                                           |\n| ------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `create()`          | `JsonPointer.create()`          | [Factory function that creates a `JsonPointer`](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#create)                                                                                                        |\n| `decode()`          | `JsonPointer.decode()`          | [Decodes the specified pointer into path segments.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#decode)                                                                                                    |\n| `flatten()`         | `JsonPointer.flatten()`         | [DEvaluates the target's object graph, returning a Record&lt;Pointer, unknown> populated with pointers and the corresponding values from the graph..](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#flatten) |\n| `get()`             | `JsonPointer.get()`             | [Gets the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#get)                                                                                               |\n| `has()`             | `JsonPointer.has()`             | [Determines if the specified target's object graph has a value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#has)                                                                |\n| `list()`            |                                 | Replaced by `JsonPointer.listFragmentIds()` and `JsonPointer.listPointers()`.                                                                                                                                                           |\n| `listFragmentIds()` | `JsonPointer.listFragmentIds()` | [Evaluates the target's object graph, returning a UriFragmentIdentifierPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listFragmentIds)                       |\n| `listPointers()`    | `JsonPointer.listPointers()`    | [Evaluates the target's object graph, returning a JsonStringPointerListItem for each location in the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#listPointers)                                     |\n| `map()`             | `JsonPointer.map()`             | [Evaluates the target's object graph, returning a Map&lt;Pointer,unknown> populated with pointers and the corresponding values form the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#map)           |\n| `set()`             | `JsonPointer.set()`             | [Sets the target object's value, as specified, at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#set)                                                                                |\n|                     | `JsonPointer.unset()`           | [Removes the target object's value at the pointer's location.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#unset)                                                                                          |\n| `visit()`           | `JsonPointer.visit()`           | [Evaluates the target's object graph, calling the specified visitor for every unique pointer location discovered while walking the graph.](http://flitbit.github.io/json-ptr/classes/_src_pointer_.jsonpointer.html#visit)              |\n\n## Tests\n\nWe're maintaining near 100% test coverage. Visit our [circleci build page](https://app.circleci.com/pipelines/github/flitbit/json-ptr) and drill down on a recent build's _build and test_ step to see where we're at. It should look something like:\n\n```text\n=============================== Coverage summary ===============================\nStatements   : 100% ( 270/270 )\nBranches     : 100% ( 172/172 )\nFunctions    : 100% ( 49/49 )\nLines        : 100% ( 265/265 )\n================================================================================\n```\n\nWe use [mocha](https://mochajs.org/) so you can also clone the code and:\n\n```text\n$ npm install\n$ npm test\n```\n\nOnce you've run the tests on the command line you can open up [./tests.html](https://github.com/flitbit/json-ptr/blob/master/tests.html) in the browser of your choice.\n\n## Performance\n\n> WARNING! These performance metrics are quite outdated. We'll be updating as soon as we have time.\n\nThis repository has a [companion repository that makes some performance comparisons](https://github.com/flitbit/json-pointer-comparison) between `json-ptr`, [`jsonpointer`](https://www.npmjs.com/package/jsonpointer) and [`json-pointer`](https://www.npmjs.com/package/json-pointer).\n\n**All timings are expressed as nanoseconds:**\n\n```text\n.flatten(obj)\n...\nMODULE       | METHOD  | COMPILED | SAMPLES |       AVG | SLOWER\njson-pointer | dict    |          | 10      | 464455181 |\njson-ptr     | flatten |          | 10      | 770424039 | 65.88%\njsonpointer  | n/a     |          | -       |         - |\n\n.has(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 822  |\njson-ptr     | has    |          | 1000000 | 1747 | 112.53%\njson-pointer | has    |          | 1000000 | 2683 | 226.4%\njsonpointer  | n/a    |          | -       | -    |\n\n.has(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | has    | compiled | 1000000 | 602  |\njson-ptr     | has    |          | 1000000 | 1664 | 176.41%\njson-pointer | has    |          | 1000000 | 2569 | 326.74%\njsonpointer  | n/a    |          | -       | -    |\n\n.get(obj, pointer)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 590  |\njson-ptr     | get    |          | 1000000 | 1676 | 184.07%\njsonpointer  | get    | compiled | 1000000 | 2102 | 256.27%\njsonpointer  | get    |          | 1000000 | 2377 | 302.88%\njson-pointer | get    |          | 1000000 | 2585 | 338.14%\n\n.get(obj, fragmentId)\n...\nMODULE       | METHOD | COMPILED | SAMPLES | AVG  | SLOWER\njson-ptr     | get    | compiled | 1000000 | 587  |\njson-ptr     | get    |          | 1000000 | 1673 | 185.01%\njsonpointer  | get    | compiled | 1000000 | 2105 | 258.6%\njsonpointer  | get    |          | 1000000 | 2451 | 317.55%\njson-pointer | get    |          | 1000000 | 2619 | 346.17%\n\n```\n\n> These results have been elided because there is too much detail in the actual. Your results will vary slightly depending on the resources available where you run it.\n\nIt is important to recognize in the performance results that _compiled_ options are faster. As a general rule, you should _compile_ any pointers you'll be using repeatedly.\n\n## Releases\n\n- 2022-02-02 — **3.1.0**\n\n  - [fixed issue #48](https://github.com/flitbit/json-ptr/issues/48) wherein, when calling any of the `.set()` methods, which in turn rely on [`setValueAtPath()`](https://flitbit.github.io/json-ptr/modules.html#setValueAtPath), _and_ using the `force` argument to enable creating an object graph, one character path segments were interpreted as numbers, which resulted in unintended object graphs being created when the character was not an integer.\n  - fixed borked documentation as reported in [issue #44](https://github.com/flitbit/json-ptr/issues/44)\n\n- 2021-10-26 — **3.0.0** **Potential Security Vulnerability Patched**\n  - When setting a value on an object graph, a developer could purposely use `json-ptr` to pollute an object's prototype by passing invalid path segments to the set/unset operations. This behavior has been disallowed.\n- 2021-05-14 — **2.2.0** _Added Handling for Relative JSON Pointers_\n  - [Example usage](https://github.com/flitbit/json-ptr/blob/487182100a08f4ddc7713e42ec063bbd5ce2c34c/examples/relative.js)\n- 2021-05-12 — **2.1.1** _Bug fix for [#36](https://github.com/flitbit/json-ptr/issues/36)_\n  - @CarolynWebster reported an unintentional behavior change starting at v1.3.0. An operation involving a pointer/path that crossed a null value in the object graph resulted in an exception. In versions prior to v1.3.0 it returned `undefined` as intended. The original behavior has been restored.\n- 2021-05-12 — **2.1.0** _Bug fixes for [#28](https://github.com/flitbit/json-ptr/issues/28) and [#30](https://github.com/flitbit/json-ptr/issues/30); **Security Vulnerability Patched**_\n\n  - When compiling the accessors for quickly accessing points in an object graph, the `.get()` method was not properly delimiting single quotes. This error caused the get operation to throw an exception in during normal usage. Worse, in cases where malicious user input was sent directly to `json-ptr`, the failure to delimit single quotes allowed the execution of arbitrary code (an injection attack). The first of these issues was reported in #28 by @mprast, the second (vulnerability) by @zpbrent. Thanks also to @elimumford for the actual code used for the fix.\n\n  - If your code sent un-sanitized user input to the `.get()` method of `json-ptr`, your project was susceptible to this security vulnerability!\n\n- 2020-10-21 — **2.0.0** _*Breaking Change*_\n  - Prototype pollution using this library is now disallowed and will throw an error. I've been looking into the origin of this issue and it seems to have been disclosed by mohan on [huntr.dev](https://www.huntr.dev/bounties/1-npm-json-ptr/). I received [a PR from](https://github.com/flitbit/json-ptr/pull/26) [@luci-m-666](https://github.com/luci-m-666), but found [another PR](https://github.com/418sec/json-ptr/pull/1) by [@alromh87](https://github.com/alromh87) that looks like the origin of the solution. Don't know who to thank, but thanks all -- somebody is due a bounty.\n  - Just in case somebody was relying on `json-ptr` to support pointers across the prototype, I'm rolling the major version number because you're now broken.\n\n> BEWARE of [Breaking Changes at v1.3.0!](#user-content-where-did-the-global-functions-go)\n\n- 2020-07-20 — **1.3.2**\n\n  - Added missing `tslib` dependency.\n  - Documented [where the global functions are now located; moving them broke compatibility at v1.3.0](#user-content-where-did-the-global-functions-go).\n\n- 2020-07-10 — **1.3.0** **BREAKING CHANGES**\n\n  - **BREAKING CHANGE:** Global functions are now static functions on the `JsonPointer` type. See [_Where did the Global Functions Go?_](#user-content-where-did-the-global-functions-go)\n  - Merged new `.unset()` function contributed by @chrishalbert, updated dependencies.\n  - Migrated to typescript and retooled build/test/deploy pipeline. Definitely typed.\n  - 100% test coverage which illuminated some idiosyncrasies; maybe we killed unobserved bugs, nobody knows.\n\n- 2019-09-14 — **1.2.0**\n\n  - Merged new `.concat` function contributed by @vuwuv, updated dependencies.\n\n- 2019-03-10 — **1.1.2**\n\n  - Updated packages to remove critical security concern among dev dependencies'\n\n- 2016-07-26 — **1.0.1**\n\n  - Fixed a problem with the Babel configuration\n\n- 2016-01-12 — **1.0.0**\n\n  - Rolled major version to 1 to reflect breaking change in `.list(obj, fragmentId)`.\n\n- 2016-01-02 — **0.3.0**\n\n  - Retooled for node 4+\n  - Better compiled pointers\n  - Unrolled recursive `.list` function\n  - Added `.map` function\n  - Fully linted\n  - Lots more tests and examples.\n  - Documented many previously undocumented features.\n\n- 2014-10-21 — **0.2.0** Added #list function to enumerate all properties in a graph, producing fragmentId/value pairs.\n\n## License\n\n[MIT](https://github.com/flitbit/json-ptr/blob/master/LICENSE)\n","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"29bfad06049d51eb909877dd08f30e67d260849a","scripts":{"ci":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts --timeout=10000 --exit --reporter mocha-junit-reporter --reporter-options mochaFile=reports/mocha/test-results.xml","docs":"typedoc src/index.ts && shx cp docs-overlay/* docs/","lint":"eslint . --ext .ts,.tsx","test":"cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\", \"noEmit\": false }' nyc mocha src/**/*.spec.ts","build":"npm run buildall","clean":"shx rm -fr coverage dist dist.browser docs tmp .nyc_output","preci":"npm run cibuild","cilint":"eslint . --ext .ts,.tsx --format junit --output-file ./reports/eslint/eslint.xml","cibuild":"npm run buildall","predocs":"shx rm -fr docs","buildall":"npm run build-lib && npm run build:browser && npm run build:browser-tests && npm run docs","lint:fix":"eslint . --ext .ts,.tsx --fix","prebuild":"npm run lint","build-lib":"rollup -c","precibuild":"npm run cilint","test:watch":"onchange --initial \"*.js\" \"*.json\" \"src/**/*.ts\" -- npm run test","prebuild-lib":"shx rm -fr dist","build:browser":"webpack","postbuild-lib":"shx cp package-cjs.json dist/cjs/package.json && shx cp package-esm.json dist/esm/package.json","prebuild:browser":"shx rm -fr dist.browser","build:browser-tests":"webpack --config webpack.tests.config.js"},"_npmUser":{"name":"cerebralkungfu","email":"phillip@flitbit.com"},"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"_npmVersion":"6.14.15","description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","directories":{},"_nodeVersion":"14.18.2","_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"nyc":"^15.1.0","shx":"^0.3.4","bent":"^7.3.12","chai":"^4.3.6","util":"^0.12.4","uuid":"^7.0.3","mocha":"^9.2.0","eslint":"^8.8.0","rimraf":"~3.0.2","rollup":"^2.67.0","process":"^0.11.10","ts-node":"^10.4.0","typedoc":"^0.22.11","webpack":"^5.68.0","onchange":"^7.1.0","prettier":"^2.5.1","cross-env":"^7.0.3","ts-loader":"^9.2.6","typescript":"^4.5.5","@types/bent":"^7.3.2","@types/chai":"^4.3.0","@types/node":"^17.0.14","webpack-cli":"^4.9.2","@types/debug":"^4.1.7","@types/mocha":"^9.1.0","@types/assert-plus":"^1.0.4","eslint-plugin-mocha":"^10.0.3","mocha-junit-reporter":"^2.0.2","rollup-plugin-terser":"^7.0.2","terser-webpack-plugin":"^5.3.1","eslint-config-prettier":"^8.3.0","eslint-plugin-prettier":"^4.0.0","@rollup/plugin-commonjs":"^21.0.1","@rollup/plugin-typescript":"^8.3.0","@typescript-eslint/parser":"^5.10.2","rollup-plugin-typescript2":"^0.31.2","@rollup/plugin-node-resolve":"^13.1.3","@typescript-eslint/eslint-plugin":"^5.10.2","rollup-plugin-peer-deps-external":"^2.2.4"},"_npmOperationalInternal":{"tmp":"tmp/json-ptr_3.1.2-dependabot-npm-and-yarn-webpack-5-76-0.29bfad0_1678833335950_0.34893176698638895","host":"s3://npm-registry-packages"},"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info."}},"time":{"created":"2013-06-11T16:01:45.074Z","modified":"2026-01-09T19:31:21.167Z","0.1.0":"2013-06-11T16:01:46.024Z","0.1.1":"2013-10-02T14:09:59.139Z","0.2.0":"2014-10-21T17:02:23.928Z","0.3.0":"2016-01-04T03:35:02.154Z","0.3.1":"2016-01-04T03:56:33.162Z","1.0.0":"2016-01-12T19:40:17.990Z","1.0.1":"2016-07-31T14:16:19.390Z","1.1.0":"2018-02-24T21:49:53.824Z","1.1.1":"2018-10-14T19:12:28.462Z","1.1.2":"2019-03-10T16:45:49.557Z","1.2.0":"2019-09-14T13:35:26.672Z","1.2.0-ts.38ea8fe":"2020-02-17T16:47:47.142Z","1.2.0-ts.da6e2a1":"2020-02-17T16:48:39.005Z","1.2.1-ts.64a7978.0":"2020-02-24T12:45:25.356Z","1.2.1-ts.33951c4.0":"2020-03-08T15:41:32.974Z","1.2.1-ts.c739a2e.0":"2020-03-28T15:22:57.342Z","1.2.1-ts.93dc79c.0":"2020-07-10T13:23:40.124Z","1.2.1-ts.eec9b2a.0":"2020-07-10T15:41:57.098Z","1.2.1-ts.54cfffa":"2020-07-10T16:03:18.325Z","1.2.1-ts.d9366c0":"2020-07-10T19:25:53.057Z","1.2.1-ts.cf62f17":"2020-07-10T19:56:33.987Z","1.2.1-master.9e1cb86":"2020-07-10T19:58:04.609Z","1.3.0":"2020-07-10T20:10:34.873Z","1.3.1-master.8983378":"2020-07-10T20:10:51.264Z","1.3.1-master.f714cdc":"2020-07-10T20:23:18.056Z","1.3.1-master.ef9842c":"2020-07-10T20:34:25.138Z","1.3.1-master.6759cc9":"2020-07-12T15:40:01.737Z","1.3.1-master.b170f35":"2020-07-12T15:51:17.161Z","1.3.1-master.ed42d86":"2020-07-12T15:54:46.450Z","1.3.1-master.045068f":"2020-07-12T15:56:04.165Z","1.3.2-master.3531b8f":"2020-07-12T15:57:24.772Z","1.3.1":"2020-07-12T15:57:49.641Z","1.3.2-dependabot-npm-and-yarn-lodash-4-17-19.7fd4b3e":"2020-07-16T01:13:08.564Z","1.3.2-master.b8ed3fc":"2020-07-19T20:40:24.561Z","1.3.2-master.4077c81":"2020-07-19T20:54:35.782Z","1.3.2-master.b0d7d5e":"2020-07-19T20:56:24.708Z","1.3.3-master.10cfb6b":"2020-07-20T12:28:34.735Z","1.3.2":"2020-07-20T12:28:49.435Z","1.3.3-master.983a133":"2020-07-20T13:04:46.893Z","1.3.3-master.f23e2e5":"2020-10-21T18:52:30.655Z","2.0.0":"2020-10-21T19:18:25.968Z","2.0.1-master.bd99031":"2020-10-21T19:18:30.281Z","2.0.1-master.434066d":"2021-05-11T14:06:08.183Z","2.0.1-issue-28-and-30.f825bd7":"2021-05-11T16:44:47.167Z","2.0.1-master.2539e34":"2021-05-12T17:12:14.048Z","2.1.0":"2021-05-12T18:40:51.045Z","2.1.1-master.6efd1ec":"2021-05-12T18:41:03.527Z","2.1.1-issue-36.f2a3959":"2021-05-12T20:05:26.894Z","2.1.1-master.98922c7":"2021-05-12T20:09:48.831Z","2.1.2-master.bdd6317":"2021-05-12T20:22:22.938Z","2.1.1":"2021-05-12T20:22:33.298Z","2.1.2-relative.2485c9e":"2021-05-13T20:16:55.490Z","2.1.2-relative.ab59597":"2021-05-13T20:53:05.230Z","2.1.2":"2021-05-13T20:54:43.508Z","2.1.3-master.51308ff":"2021-05-13T20:55:04.122Z","2.1.2-relative.03b7b06":"2021-05-13T21:29:29.214Z","2.1.2-relative.3103314":"2021-05-14T11:53:43.999Z","2.1.2-relative.f48c5e7":"2021-05-14T12:32:17.590Z","2.1.3-master.4871821":"2021-05-14T12:38:09.685Z","2.1.3-master.eaf24e6":"2021-05-14T12:40:52.908Z","2.2.0":"2021-05-14T12:42:51.468Z","2.2.1-master.0c06aa1":"2021-05-14T12:54:10.530Z","2.2.1-master.456a172":"2021-05-14T13:13:02.430Z","2.2.1-packaging-rollup.7af30ca":"2021-10-26T15:51:45.142Z","2.2.1-master.18a4d58":"2021-10-26T15:54:41.039Z","3.0.0":"2021-10-26T15:59:17.769Z","3.0.1-master.2d8c1ab":"2021-10-26T15:59:26.244Z","3.0.1-master.55c1dd5":"2021-10-26T23:18:28.176Z","3.0.1-older-nodes.e0918b8":"2021-11-19T23:24:23.780Z","3.0.1-master.cb11e0b":"2021-11-19T23:25:21.839Z","3.0.1":"2021-11-19T23:34:24.985Z","3.0.2-master.a2e0055":"2021-11-19T23:34:36.138Z","3.0.2-master.2e0b67f":"2021-11-19T23:55:34.815Z","3.0.2-bug-issue-48.6c9db9f":"2022-02-02T20:35:37.595Z","3.0.2-master.50697cc":"2022-02-02T20:38:16.010Z","3.0.2-main.50697cc":"2022-02-02T20:40:26.899Z","3.0.2-main.afa67f9":"2022-02-02T20:58:37.546Z","3.0.2-main.e7bd39d":"2022-02-02T21:01:45.216Z","3.0.2-main.1916627":"2022-02-02T21:32:42.748Z","3.0.2-main.78e4a61":"2022-02-02T21:35:58.414Z","3.1.0":"2022-02-02T21:52:58.574Z","3.1.1-main.02aa710":"2022-02-02T21:53:01.384Z","3.1.1-fix-examples.80a275d":"2022-02-03T20:02:41.015Z","3.1.1-main.677a678":"2022-02-03T20:09:33.936Z","3.1.1-symbols.0e6db58":"2022-02-04T22:20:02.938Z","3.1.1-dependabot-npm-and-yarn-minimist-1-2-6.98d2cb6":"2022-04-09T04:18:58.108Z","3.1.1-main.3292abf":"2022-07-13T00:03:53.558Z","3.1.2-main.1988f05":"2022-07-13T00:10:39.325Z","3.1.1":"2022-07-13T00:10:55.488Z","3.1.2-dependabot-npm-and-yarn-json5-2-2-3.c209166":"2023-01-07T04:49:37.488Z","3.1.2-dependabot-npm-and-yarn-webpack-5-76-0.29bfad0":"2023-03-14T22:35:36.132Z"},"bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"license":"MIT","homepage":"https://github.com/flitbit/json-ptr#readme","keywords":["6901","json","pointers","fragmentid"],"repository":{"url":"git+https://github.com/flitbit/json-ptr.git","type":"git"},"description":"A complete implementation of JSON Pointer (RFC 6901) for nodejs and modern browsers.","maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"readme":"","readmeFilename":"","users":{"burl.bn":true,"wanderer":true}}