{"name":"@jsonjoy.com/json-pointer","version":"1.0.2","keywords":["json-pointer","json","pointer","jit","selector","pick"],"author":{"url":"https://github.com/streamich","name":"streamich"},"license":"Apache-2.0","_id":"@jsonjoy.com/json-pointer@1.0.2","maintainers":[{"name":"json-joy-team","email":"team@jsonjoy.com"},{"name":"streamich","email":"vadimsdaleckis@gmail.com"}],"homepage":"https://github.com/jsonjoy-com/json-pointer","bugs":{"url":"https://github.com/jsonjoy-com/json-pointer/issues"},"dist":{"shasum":"049cb530ac24e84cba08590c5e36b431c4843408","tarball":"http://registry-npm.ywwl.com/@jsonjoy.com/json-pointer/download/@jsonjoy.com/json-pointer-1.0.2.tgz","fileCount":34,"integrity":"sha512-Fsn6wM2zlDzY1U+v4Nc8bo3bVqgfNTGcn6dMgs6FjrEnt4ZCe60o6ByKRjOGlI2gow0aE/Q41QOigdTqkyK5fg==","signatures":[{"sig":"MEUCIFNGQvXwEf0jsh7Z4iaYecqW3fp/Uf+p0rcFC0TDPplQAiEA5dyGs8CbfleNp9XBqRohU41snPHgBUygE4tum8IrIpo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29637,"size":7090,"noattachment":false,"key":"/@jsonjoy.com/json-pointer/-/@jsonjoy.com/json-pointer-1.0.2.tgz"},"main":"lib/index.js","types":"lib/index.d.ts","engines":{"node":">=10.0"},"funding":{"url":"https://github.com/sponsors/streamich","type":"github"},"gitHead":"c536264ed17858b7f094328d59efd9047b3030e0","scripts":{"lint":"biome lint ./src","test":"vitest ./src","build":"tsc --project tsconfig.build.json --module commonjs --target es2020 --outDir lib","clean":"npx rimraf@6.0.1 lib typedocs coverage gh-pages yarn-error.log","format":"biome format ./src","typedoc":"npx typedoc@0.25.13 --tsconfig tsconfig.build.json","coverage":"vitest run --coverage","lint:fix":"biome lint --apply ./src","format:fix":"biome format --write ./src","build:pages":"npx rimraf@6.0.1 gh-pages && mkdir -p gh-pages && cp -r typedocs/* gh-pages && cp -r coverage gh-pages/coverage","deploy:pages":"gh-pages -d gh-pages","publish-coverage-and-typedocs":"yarn typedoc && yarn coverage && yarn build:pages && yarn deploy:pages"},"typings":"lib/index.d.ts","_npmUser":{"name":"streamich","email":"vadimsdaleckis@gmail.com"},"repository":{"url":"git+https://github.com/jsonjoy-com/json-pointer.git","type":"git"},"_npmVersion":"10.8.2","description":"High-performance JSON Pointer implementation","directories":{},"_nodeVersion":"20.19.4","dependencies":{"@jsonjoy.com/util":"^1.9.0","@jsonjoy.com/codegen":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"packageManager":"yarn@4.5.0","devDependencies":{"tslib":"^2.7.0","vitest":"^2.1.2","benchmark":"^2.1.4","typescript":"^5.6.2","config-galore":"^1.0.0","@biomejs/biome":"^1.9.3","@types/benchmark":"^2.1.5","@vitest/coverage-v8":"^2.1.2"},"peerDependencies":{"tslib":"2"},"_npmOperationalInternal":{"tmp":"tmp/json-pointer_1.0.2_1756038376027_0.47657831494037084","host":"s3://npm-registry-packages-npm-production"},"readme":"# JSON Pointer - `json-pointer`\n\nFast implementation of [JSON Pointer (RFC 6901)][json-pointer]\nspecification in TypeScript.\n\n[json-pointer]: https://tools.ietf.org/html/rfc6901\n\n\n## Usage\n\nCan find a value in a JSON object using three methods: (1) JSON Pointer string,\n(2) array of steps, or (3) a pre-compiled function.\n\n\n## Examples\n\nFind the value in a JSON document at some specific location.\n\n\n### Find by JSON Pointer string\n\n```js\nimport { findByPointer } from '@jsonjoy.com/json-pointer';\n\nconst doc = {\n  foo: {\n    bar: 123,\n  },\n};\n\nconst res = findByPointer(doc, '/foo/bar');\n```\n\n\n### Find by path array\n\nAlternatively, you can specify an array of steps, such as `['foo', 'bar']`. Or,\nuse the `parseJsonPointer` function to convert a JSON Pointer string to an array.\n\n```js\nimport { find, parseJsonPointer } from '@jsonjoy.com/json-pointer';\n\nconst doc = {\n  foo: {\n    bar: 123,\n  },\n};\n\nconst path = parseJsonPointer('/foo/bar');\nconst ref = find(doc, path);\n\nconsole.log(ref);\n// { val: 123, obj: { bar: 123 }, key: 'bar' }\n```\n\n\n### Pre-compiled function\n\nIf you know the path in advance, you can compile a function that will find the\nvalue at that location, it will work few times faster than the previous methods.\n\n```js\nimport { $$find } from '@jsonjoy.com/json-pointer/lib/codegen';\n\nconst doc = {\n  foo: {\n    bar: 123,\n  },\n};\nconst finder = $$find(['foo', 'bar']);\n\nconst res = finder(doc);\n```\n\n\n## Low-level API\n\nConvert JSON Pointer to path array and back.\n\n```js\nimport { parseJsonPointer } from '@jsonjoy.com/json-pointer';\n\nconsole.log(parseJsonPointer('/f~0o~1o/bar/1/baz'));\n// [ 'f~o/o', 'bar', '1', 'baz' ]\n\nconsole.log(formatJsonPointer(['f~o/o', 'bar', '1', 'baz']));\n// /f~0o~1o/bar/1/baz\n```\n\nDecode and encode a single step of JSON Pointer.\n\n```js\nconsole.log(unescapeComponent('~0~1'));\n// ~/\n\nconsole.log(escapeComponent('~/'));\n// ~0~1\n```\n","publish_time":1756038376206,"_cnpm_publish_time":1756038376206,"dist-tags":{"latest":"18.30.0"}}