{"nyc":{"include":["src/**/*.ts"],"require":["ts-node/register"],"reporter":["text-summary","html"],"extension":[".ts",".tsx"],"sourceMap":true,"instrument":true},"bugs":{"url":"https://github.com/flitbit/json-ptr/issues"},"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","name":"json-ptr","types":"dist/index.d.ts","author":{"name":"Phillip Clark","email":"phillip@flitbit.com"},"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","license":"MIT","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"},"homepage":"https://github.com/flitbit/json-ptr#readme","keywords":["6901","json","pointers","fragmentid"],"deprecated":"Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.","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":{},"maintainers":[{"name":"cerebralkungfu","email":"phillip@flitbit.com"}],"_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"},"_id":"json-ptr@1.3.2-master.3531b8f","version":"1.3.2-master.3531b8f"}