{"_id":"@sagold/json-query","_rev":"8-f6afd78ea756436625eaa4174e392e3a","name":"@sagold/json-query","description":"json-pointer utilities for querying and transforming data","dist-tags":{"latest":"6.2.0"},"versions":{"1.0.0":{"name":"@sagold/json-query","version":"1.0.0","description":"json-pointer utilities for querying data","main":"lib/index.js","dependencies":{"@sagold/json-conform":"^1.0.0","@sagold/json-pointer":"^1.0.1"},"devDependencies":{"mocha":"^3.1.2","watch":"^1.0.1","chai":"^3.5.0"},"scripts":{"test":"mocha --recursive 'test/unit/*.test.js' -R spec; exit 0","tdd":"watch 'npm run test' lib/ app/ test/; exit 0","pub":"npm publish --access public"},"keywords":[],"author":{"name":"Sascha Goldhofer","email":"noreply@saschagoldhofer.de","url":"https://github.com/sagold/"},"license":"ISC","gitHead":"e89580658ec5e6452a6fe7b20df685fbb39e00e1","_id":"@sagold/json-query@1.0.0","_shasum":"5162e1d95180fd8967ea0d6d99cbfa30d1ea8233","_from":".","_npmVersion":"3.10.9","_nodeVersion":"6.9.1","_npmUser":{"name":"sagold","email":"noreply@saschagoldhofer.de"},"dist":{"shasum":"5162e1d95180fd8967ea0d6d99cbfa30d1ea8233","tarball":"https://registry.npmjs.org/@sagold/json-query/-/json-query-1.0.0.tgz","integrity":"sha512-zM0ZUCt6JszBDRr2s/7kD0Y+JOAZnxBaJFOWg/vJelLuEAchjvrYyc4Jrvfkr0IZCne7oxjKAhHGVqb/OZ9kLA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCh+Z7B8gDV2pr06Ucl0Fin0TFLKHd6R3YKDQkjEgTmmQIga4j9KQpujRGHwGq+bpYUcNhziVdianBcvFLEtzOv1y4="}]},"maintainers":[{"name":"sagold","email":"noreply@saschagoldhofer.de"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/json-query-1.0.0.tgz_1479068548170_0.4686498015653342"},"directories":{}},"6.0.0":{"name":"@sagold/json-query","version":"6.0.0","description":"json-pointer utilities for querying and transforming data","module":"dist/module/index.js","types":"dist/index.d.ts","main":"dist/jsonQuery.js","repository":{"type":"git","url":"git+https://github.com/sagold/json-query.git"},"scripts":{"dist":"rm -rf dist; npm run dist:es5; npm run dist:es6","dist:es5":"NODE_ENV='production' webpack","dist:es6":"tsc --outDir dist/module --target ES2019","test":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/**/*.test.ts'","test:get":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/get.test.ts'","test:set":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/set.test.ts'","test:pattern":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/get.pattern.test.ts'","lint":"eslint lib test","prepublishOnly":"npm run test & npm run lint & npm run dist","coverage":"nyc npm run test --reporter=lcov","debug":"devtool node_modules/mocha/bin/_mocha -qc -- --recursive test/unit/*.test.js"},"dependencies":{"@sagold/json-pointer":"^5.0.0","ebnf":"^1.9.0"},"devDependencies":{"@types/chai":"^4.2.14","@types/mocha":"^10.0.1","@types/node":"^16.18.3","@typescript-eslint/eslint-plugin":"^5.38.1","@typescript-eslint/parser":"^5.38.1","chai":"^4.2.0","eslint":"^8.29.0","mocha":"^10.1.0","nyc":"^15.1.0","terser-webpack-plugin":"^5.3.6","ts-loader":"^9.4.2","ts-node":"^10.9.1","typescript":"^4.9.3","webpack":"^5.75.0","webpack-cli":"^5.0.0"},"keywords":["query","json","json-query","glob-pattern","library","make my day"],"author":{"name":"Sascha Goldhofer","email":"github@saschagoldhofer.de","url":"https://github.com/sagold/"},"license":"MIT","gitHead":"9443c132e3b802e85181ddb15f46784adcc667be","bugs":{"url":"https://github.com/sagold/json-query/issues"},"homepage":"https://github.com/sagold/json-query#readme","_id":"@sagold/json-query@6.0.0","_nodeVersion":"16.16.0","_npmVersion":"8.11.0","dist":{"integrity":"sha512-fk9BimvNrzlhXiy+dvlwyA97W2N6GmPWCJo/2kwKEtU9oc93cVKamca9NcnjKx1hhjECjPfu30NQ8Tg2JGv/pA==","shasum":"a250a98d19cc20d8c06e8e9eeaf9d1de833f1ed4","tarball":"https://registry.npmjs.org/@sagold/json-query/-/json-query-6.0.0.tgz","fileCount":28,"unpackedSize":63032,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAiawSMPrhx8JcmgVSTWyy9EIfOVHTUrkbF6Qi+ohuBcAiB9HmlxFXbv60INaI0hsNjEJbHlr27/HFsQVvO07iEnLA=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjjRDYACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrG/A//er81OnCWM09amjmRkYIGMeM+K2Hq6IDAQID7Q6bsuIIPOmOl\r\n/PfVbRtg0bTLuYvlYmjFKoIQ+h/kMQwWZl4392bAU/azoUIfqhK8lYai5ATR\r\nywWHKclQ58T2Y8Pyn6PDselkzpgJlwtIhU/4MuxKzSK769ip+Qdvr+OlpCGv\r\noqnVNDq5HqQYiZbLFPtaLVtf2ppWjp8/RlJ1CvBAYxJXl5ndo/v1B0IRgF7d\r\nH69k0DQiEEfAOIJYwv9y/dIaauToWc42+KB7+bFXsCGdobwZ4q1dgyJ8zfM0\r\nSEBvAv+Z+F+tfT8hzKx4Q/Fi4jAufaRo65rtGupCs40YK29cKaXKsZ8n5j7v\r\nQv752WAV+kwqEePaAaNEhBX6q2b77e1vtUium/IqRhd7OnnpIhtOv98hv5Q9\r\nnJ7EPScK3lswusdJLlJmNQtCyWCBrkz5XDkOXnLcBy34BG7SO/MWOck1GB8Y\r\ngLkmAsqnLxnbTxkUQp3J2jyXRZe3mwGa5REUrVIhm3U0Ws5kHCFizRBNeImj\r\n2/o6G5qcSNAMgJBUEZfULGiNfvaHeOpl0v5JfsV3JfYDjiXFlpQRHDfNFfib\r\nTrcujEHfmn0YvlXcgE22taNn7+UMaDiTXsaCzR7FvEv1yy9J6nZhhgMtg7K6\r\n9JZORgetRuxe4HFEC9xt/9r005uqzDBnloI=\r\n=i+fV\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"sagold","email":"noreply@saschagoldhofer.de"},"directories":{},"maintainers":[{"name":"sagold","email":"noreply@saschagoldhofer.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-query_6.0.0_1670189272584_0.4759843345024042"},"_hasShrinkwrap":false},"6.1.0":{"name":"@sagold/json-query","version":"6.1.0","description":"json-pointer utilities for querying and transforming data","module":"dist/module/index.js","types":"dist/index.d.ts","main":"dist/jsonQuery.js","repository":{"type":"git","url":"git+https://github.com/sagold/json-query.git"},"scripts":{"dist":"rm -rf dist; npm run dist:es5; npm run dist:es6","dist:es5":"NODE_ENV='production' webpack","dist:es6":"tsc --outDir dist/module --target ES2019","test":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/**/*.test.ts'","test:get":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/get.test.ts'","test:set":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/set.test.ts'","test:pattern":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/get.pattern.test.ts'","lint":"eslint lib test","prepublishOnly":"npm run test & npm run lint & npm run dist","coverage":"nyc npm run test --reporter=lcov","debug":"devtool node_modules/mocha/bin/_mocha -qc -- --recursive test/unit/*.test.js"},"dependencies":{"@sagold/json-pointer":"^5.1.0","ebnf":"^1.9.1"},"devDependencies":{"@types/chai":"^4.3.5","@types/mocha":"^10.0.1","@types/node":"^20.3.3","@typescript-eslint/eslint-plugin":"^5.60.1","@typescript-eslint/parser":"^5.60.1","chai":"^4.2.0","eslint":"^8.44.0","mocha":"^10.2.0","nyc":"^15.1.0","terser-webpack-plugin":"^5.3.9","ts-loader":"^9.4.4","ts-node":"^10.9.1","typescript":"^5.1.6","webpack":"^5.88.1","webpack-cli":"^5.1.4"},"keywords":["query","json","json-query","glob-pattern","library","make my day"],"author":{"name":"Sascha Goldhofer","email":"github@saschagoldhofer.de","url":"https://github.com/sagold/"},"license":"MIT","gitHead":"aba90e3d2a67b34bea254f973886b3593d46a3f0","bugs":{"url":"https://github.com/sagold/json-query/issues"},"homepage":"https://github.com/sagold/json-query#readme","_id":"@sagold/json-query@6.1.0","_nodeVersion":"18.16.1","_npmVersion":"9.7.2","dist":{"integrity":"sha512-my8W23qwd19HLXiDgeAnwT53sF1DHuW5+Uom46bV0GPHVsJdqS3mh9eDeR7CMoyIbvcUTZcKBKzzoPtWxQh03g==","shasum":"cf84a190dbf68494c26596ae2646fbe0a4c68529","tarball":"https://registry.npmjs.org/@sagold/json-query/-/json-query-6.1.0.tgz","fileCount":28,"unpackedSize":61743,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBo/SM/1KnHwXWqPg3uYW6JjVLJnWqL0G+K8W0Qbma8AAiAm8j0WU9OSHc6otREg27Uk9UWl5TUYu/Ok6InuLE2iBA=="}]},"_npmUser":{"name":"sagold","email":"noreply@saschagoldhofer.de"},"directories":{},"maintainers":[{"name":"sagold","email":"noreply@saschagoldhofer.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-query_6.1.0_1688199565480_0.918932600130937"},"_hasShrinkwrap":false},"6.1.1":{"name":"@sagold/json-query","version":"6.1.1","description":"json-pointer utilities for querying and transforming data","module":"dist/module/index.js","types":"dist/index.d.ts","main":"dist/jsonQuery.js","repository":{"type":"git","url":"git+https://github.com/sagold/json-query.git"},"scripts":{"dist":"rm -rf dist; npm run dist:es5; npm run dist:es6","dist:es5":"NODE_ENV='production' webpack","dist:es6":"tsc --outDir dist/module --target ES2019","test":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/**/*.test.ts'","test:get":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/get.test.ts'","test:set":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/set.test.ts'","test:pattern":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/get.pattern.test.ts'","lint":"eslint lib test","prepublishOnly":"npm run test & npm run lint & npm run dist","coverage":"nyc npm run test --reporter=lcov","debug":"devtool node_modules/mocha/bin/_mocha -qc -- --recursive test/unit/*.test.js"},"dependencies":{"@sagold/json-pointer":"^5.1.1","ebnf":"^1.9.1"},"devDependencies":{"@types/chai":"^4.3.5","@types/mocha":"^10.0.1","@types/node":"^20.3.3","@typescript-eslint/eslint-plugin":"^5.60.1","@typescript-eslint/parser":"^5.60.1","chai":"^4.2.0","eslint":"^8.44.0","mocha":"^10.2.0","nyc":"^15.1.0","terser-webpack-plugin":"^5.3.9","ts-loader":"^9.4.4","ts-node":"^10.9.1","typescript":"^5.1.6","webpack":"^5.88.1","webpack-cli":"^5.1.4"},"keywords":["query","json","json-query","glob-pattern","library","make my day"],"author":{"name":"Sascha Goldhofer","email":"github@saschagoldhofer.de","url":"https://github.com/sagold/"},"license":"MIT","gitHead":"087528b24a5603598f0f5f6185c96c6a2e88959b","bugs":{"url":"https://github.com/sagold/json-query/issues"},"homepage":"https://github.com/sagold/json-query#readme","_id":"@sagold/json-query@6.1.1","_nodeVersion":"18.16.1","_npmVersion":"9.7.2","dist":{"integrity":"sha512-5/Wu0rTnXmO5Uvtm9Of16Vx3mKjSnYA0Um9LgBtyPhIucYlppKgKC4N3g8gD0Fk00a5kizQTs4gwxKPXCpmeww==","shasum":"d822c08c9d0760eadd12f9587a4da0b51c309152","tarball":"https://registry.npmjs.org/@sagold/json-query/-/json-query-6.1.1.tgz","fileCount":28,"unpackedSize":61883,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHhwGucjbZiGLY51EKcdDmMC/w0fqFJJNK9oVqJjftTDAiAaMkDosK4pf0KTq0uHZjisGZ4VTKNGpz/+LTb5j99D4g=="}]},"_npmUser":{"name":"sagold","email":"noreply@saschagoldhofer.de"},"directories":{},"maintainers":[{"name":"sagold","email":"noreply@saschagoldhofer.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-query_6.1.1_1688419048294_0.1847233514147344"},"_hasShrinkwrap":false},"6.1.3":{"name":"@sagold/json-query","version":"6.1.3","description":"json-pointer utilities for querying and transforming data","module":"dist/module/index.js","types":"dist/index.d.ts","main":"dist/jsonQuery.js","repository":{"type":"git","url":"git+https://github.com/sagold/json-query.git"},"scripts":{"dist":"rm -rf dist; npm run dist:es5; npm run dist:es6","dist:es5":"NODE_ENV='production' webpack","dist:es6":"tsc --outDir dist/module --target ES2019","test":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/**/*.test.ts'","test:get":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/get.test.ts'","test:set":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/set.test.ts'","test:pattern":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/get.pattern.test.ts'","lint":"eslint lib test","prepublishOnly":"npm run test & npm run lint & npm run dist","coverage":"nyc npm run test --reporter=lcov","debug":"devtool node_modules/mocha/bin/_mocha -qc -- --recursive test/unit/*.test.js"},"dependencies":{"@sagold/json-pointer":"^5.1.2","ebnf":"^1.9.1"},"devDependencies":{"@types/chai":"^4.3.14","@types/mocha":"^10.0.6","@types/node":"^20.11.30","@typescript-eslint/eslint-plugin":"^7.4.0","@typescript-eslint/parser":"^7.4.0","chai":"^4.4.1","eslint":"^8.57.0","mocha":"^10.4.0","nyc":"^15.1.0","terser-webpack-plugin":"^5.3.10","ts-loader":"^9.5.1","ts-node":"^10.9.2","typescript":"^5.4.3","webpack":"^5.91.0","webpack-cli":"^5.1.4"},"keywords":["query","json","json-query","glob-pattern","library","make my day"],"author":{"name":"Sascha Goldhofer","email":"github@saschagoldhofer.de","url":"https://github.com/sagold/"},"license":"MIT","_id":"@sagold/json-query@6.1.3","gitHead":"03792d246802500279e1f9f482ce048ff2909c48","bugs":{"url":"https://github.com/sagold/json-query/issues"},"homepage":"https://github.com/sagold/json-query#readme","_nodeVersion":"21.6.2","_npmVersion":"10.2.4","dist":{"integrity":"sha512-fLj4/c5okor0CkUsLCnp5PxDnNny3u7umLYwoQEMOL5MQpevEivjxSq+FZ1bFlfJQ89CaF2m912lMOafE9Gnvg==","shasum":"82fba49c6f20d427984dc0eb8a5083bf3953df00","tarball":"https://registry.npmjs.org/@sagold/json-query/-/json-query-6.1.3.tgz","fileCount":28,"unpackedSize":62806,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDQRdl0XVzFMEev8WXu9ECDApIS0NdwHTb3Du70XaZaBwIgVKOO3Hu3HiWLN2XBP7K7zeMKN2ug2SxUXAj1NK/crU4="}]},"_npmUser":{"name":"sagold","email":"noreply@saschagoldhofer.de"},"directories":{},"maintainers":[{"name":"sagold","email":"noreply@saschagoldhofer.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-query_6.1.3_1711495148947_0.9889736015746302"},"_hasShrinkwrap":false},"6.2.0":{"name":"@sagold/json-query","version":"6.2.0","description":"json-pointer utilities for querying and transforming data","module":"dist/module/index.js","types":"dist/index.d.ts","main":"dist/jsonQuery.js","repository":{"type":"git","url":"git+https://github.com/sagold/json-query.git"},"scripts":{"dist":"rm -rf dist; npm run dist:es5; npm run dist:es6","dist:es5":"NODE_ENV='production' webpack","dist:es6":"tsc --outDir dist/module --target ES2019","test":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/**/*.test.ts'","test:get":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/get.test.ts'","test:set":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/set.test.ts'","test:pattern":"TS_NODE_PROJECT=./test/tsconfig.json mocha -r ts-node/register 'test/unit/get.pattern.test.ts'","lint":"eslint lib test","prepublishOnly":"npm run test & npm run lint & npm run dist","coverage":"nyc npm run test --reporter=lcov","debug":"devtool node_modules/mocha/bin/_mocha -qc -- --recursive test/unit/*.test.js"},"dependencies":{"@sagold/json-pointer":"^5.1.2","ebnf":"^1.9.1"},"devDependencies":{"@types/chai":"^4.3.14","@types/mocha":"^10.0.6","@types/node":"^20.11.30","@typescript-eslint/eslint-plugin":"^7.4.0","@typescript-eslint/parser":"^7.4.0","chai":"^4.4.1","eslint":"^8.57.0","mocha":"^10.4.0","nyc":"^15.1.0","terser-webpack-plugin":"^5.3.10","ts-loader":"^9.5.1","ts-node":"^10.9.2","typescript":"^5.4.3","webpack":"^5.91.0","webpack-cli":"^5.1.4"},"keywords":["query","json","json-query","glob-pattern","library","make my day"],"author":{"name":"Sascha Goldhofer","email":"github@saschagoldhofer.de","url":"https://github.com/sagold/"},"license":"MIT","_id":"@sagold/json-query@6.2.0","gitHead":"3f3d882ff8cf509b8855a316a052be2b66128a85","bugs":{"url":"https://github.com/sagold/json-query/issues"},"homepage":"https://github.com/sagold/json-query#readme","_nodeVersion":"21.6.2","_npmVersion":"10.2.4","dist":{"integrity":"sha512-7bOIdUE6eHeoWtFm8TvHQHfTVSZuCs+3RpOKmZCDBIOrxpvF/rNFTeuvIyjHva/RR0yVS3kQtr+9TW72LQEZjA==","shasum":"2204a0259ea10f36cd5cb0a1505078e6d751eecd","tarball":"https://registry.npmjs.org/@sagold/json-query/-/json-query-6.2.0.tgz","fileCount":28,"unpackedSize":63032,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCxrC/2AKJ+1HxCUWqYcPyQ+tjTOADhGOJtKAM2/jWplgIgOQ1rJ2X+tm7tVjk7ivQtEzv22KnaA88cnRIDJzt6jKY="}]},"_npmUser":{"name":"sagold","email":"noreply@saschagoldhofer.de"},"directories":{},"maintainers":[{"name":"sagold","email":"noreply@saschagoldhofer.de"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/json-query_6.2.0_1712044280597_0.4157268194498369"},"_hasShrinkwrap":false}},"readme":"<h1 align=\"left\"><img src=\"./docs/sagold-json-query.png\" width=\"100%\" alt=\"@sagold/json-query\"></h1>\n\n<p align=\"left\"><b><code>json-query</code> lets you quickly select values, patterns or types from json-data. Its input requires a simple string, describing a concise query into your data.</b></p>\n\n<p align=\"center\">\n    <a href=\"#features\">Features</a> | <a href=\"#quick-introduction\">Introduction</a> | <a href=\"#api\">Api</a> | <a href=\"#about-patterns\">About patterns</a> | <a href=\"#further-examples\">Further examples</a> | <a href=\"#breaking-changes\">Breaking changes</a>\n</p>\n\n**install**\n\n`yarn add @sagold/json-query`\n\n\n## Features\n\n- [json-pointer](https://github.com/sagold/json-pointer) syntax `#/list/0/id`\n- glob-patterns for properties (`*`, `**`)\n- regex-support for properties `{any.*}`\n- pattern-support for inifinite recursion `/tree(/nodes/*)+/value`\n- or-patterns `/node((/left), (/right))`\n- finite search in circular-data `**`\n- lookahead-rules to test selected property `?property:value` and regex values `?property:{\\d+}`\n- and typechecks `/value?:array`\n\n\n## Quick introduction\n\nBasically, a **query** is a json-pointer, which describes a path of properties into the json-data\n\n```js\nimport { get } from \"@sagold/json-query\";\nconst input = { object: { a: { id: \"id-a\" }, b: { id: \"id-b\" } } };\n\nconst values = get(input, \"/object/a/id\"); // [\"id-a\"]\n```\n\n\nBut each property may also be a glob-pattern or a regular expression:\n\n`*` selects all direct children\n\n```js\nconst input = { object: { a: { id: \"id-a\" }, b: { id: \"id-b\" } } };\n\nconst values = get(input, \"/object/*/id\"); // [\"id-a\", \"id-b\"]\n```\n\n\n`**` selects all values\n\n```js\nconst input = { object: { a: { id: \"id-a\" }, b: { id: \"id-b\" } } };\n\nconst values = get(input, \"/object/**\");\n// [ { a: { id: \"id-a\" }, b: { id: \"id-b\" } }, { id: \"id-a\" }, \"id-a\", { id: \"id-b\" }, \"id-b\" ]\n```\n\n\n`{}` calls a regular expression\n\n```js\nconst input = { object: { a: { id: \"id-a\" }, b: { id: \"id-b\" } } };\n\nconst values = get(input, \"/{obj.*}/{.*}/id\"); // [\"id-a\", \"id-b\"]\n```\n\n> Note. Regular expressions within strings, have to escape any backslashes, e.g. instead of `{\\d}` you need to pass `{\\\\d}`\n\n\n**lookahead** rules are used to validate the current value based on its properties\n\n`?child` tests if a childProperty is defined\n\n```js\nconst input = { object: { a: { id: \"id-a\" }, b: { id: \"id-b\" } } };\n\nconst values = get(input, \"/object/*?id\"); // [{ id: \"id-a\" }, { id: \"id-b\" }]\n```\n\n\n`?child:value` tests if a childProperty matches a value\n\n```js\nconst input = { object: { a: { id: \"id-a\" }, b: { id: \"id-b\" } } };\n\nconst values = get(input, \"/object/*?id:id-b\"); // [{ id: \"id-b\" }]\n```\n\nlookahead rules can also be negated `?child:!value`, tested by regex `?child:{^re+}`, combined `?child&&other` or joined `?child||other`. Undefined may be tested with `?property:undefined`, per default `undefined` is excluded from matches.\n\n\n**typechecks** can be used to query certain data-types\n\n`?:<type>`, where `<type>` may be any of `[\"boolean\", \"string\", \"number\", \"object\", \"array\", \"value\"]`\n\n```js\nconst input = { object: { a: { id: 33 }, b: { id: \"id-b\" } } };\n\nconst values = get(input, \"/**?:string\"); // [\"id-b\"]\n```\n\n`?:value` will match all types except *objects* and *arrays*\n\n```js\nconst input = { object: { a: { id: 33 }, b: { id: \"id-b\" } } };\n\nconst values = get(input, \"/**?:value\"); // [33, \"id-b\"]\n```\n\n\n**patterns** can be used to combine queries into a single result (*OR*) and to build up results from recursive queries (*+*)\n\nQueries can be grouped by parenthesis, where `/a/b/c = /a(/b)(/c) = /a(/b/c)`.\n\n`((/a), (/b))` resolves both queries on the previous result\n\n```js\nconst input = { object: { a: { id: 33 }, b: { id: \"id-b\" } } };\n\nconst values = get(input, \"/object((/a), (/b))\"); // [{ id: 33 }, { id: \"id-b\" }]\n```\n\nand the result may be queried further\n\n```js\nget(input, \"/object((/a), (/b))/id\"); // [33, \"id-b\"]\nget(input, \"/object((/a), (/b))/id?:number\"); // [33]\n```\n\n`(/a)+` will repeat the grouped query for all possible results\n\n```js\nconst input = {\n    id: 1,\n    a: { // first iteration\n        id: 2,\n        a: { // second iteration\n            id: 3\n            a: 4 // last iteration\n        }\n    }\n};\n\nconst values = get(input, \"/(/a)+\"); // [{ id: 2, a: { id: 3, a: 4 } }, { id: 3, a: 4 }, 4]\n```\n\n\n**escaping properties** In case you have special characters in property-names or values, you can escape any value using doubled-quotes `\"<value>\"`:\n\n- escape property-name: `'/root/*/\"strange/property\"'` is split to `[\"root\", \"*\", \"strange/property\"]`\n- escape query-property `'/root/*?\"strange/property\":42'`\n- escape query-value `'/root/*?id:\"#/pointer/value\"'`\n\n\n## API\n\n*json-query* exposes `get`, `set`, `remove` and a `split`-helper\n\nmethod  | signature                                                         | description\n--------|-------------------------------------------------------------------|------------------------------\nget     | (input:any, query:string, returnType?:string\\|function)           | query data, returns results\nset     | (input:any, query:string, value:string\\|function, replace?:string)| set value, returns modified input\nsplit   | (query: string)                                                   | returns a list properties and queries\nremove  | (input:any, query: string, returnRemoved?:boolean)                | delete query targets, returns input\n\n\n### get\n\nper default, *get* returns a list of all values\n\n```js\nimport { get } from \"@sagold/json-query\";\nconst input = { object: { a: { id: 33 }, b: { id: \"id-b\" } } };\nconst values = get(input, \"/**?:value\"); // [33, \"id-b\"]\n```\n\nUsing the optional value `returnType` you can change the result type to the following options\n`[\"all\", \"value\", \"pointer\", \"map\"]`. The string values can also be accessed as property on `get`: `get.ALL, get.VALUE, get.POINTER, get.MAP`:\n\n\nreturnType  | description\n------------|------------------------------------------------------------------\n\"value\"     | returns all matched values of the query `[33, \"id-b\"]`\n\"pointer\"   | returns json-pointer to results `[\"#/object/a\", \"#/object/b\"]`\n\"map\"       | returns an pairs of `jsonPointer: resultValue` as an object\n\"all\"       | returns a list, where each result is an array of `[value, keyToValue, parentObject, jsonPointer]`\nfunction    | callback with `(value, keyToValue, parentObject, jsonPointer) => {}`. If a value is returned, the result will be replaced by the return-value\n\n\n```js\nimport { get } from \"@sagold/json-query\";\nconst input = { object: { a: { id: 33 }, b: { id: \"id-b\" } } };\n\nget(input, \"/**?:value\", get.VALUE); // [33, \"id-b\"]\nget(input, \"/**?:value\", get.POINTER); // [\"#/object/a/id\", \"#/object/b/id\"]\nget(input, \"/**?:value\", get.MAP); // { \"#/object/a/id\": 33, \"#/object/b/id\": \"id-b\" }\n\nget(input, \"/**?:value\", get.ALL);\n// [\n//    [33, \"id\", { id: 33 }, \"#/object/a/id\"],\n//    [\"id-b\", \"id\", { id: \"id-b\" }, \"#/object/b/id\"]\n// ]\n\nget(input, \"/**?:value\", (value, key, parent, pointer) => `custom-${pointer}`);\n// [\"custom-#/object/a/id\", \"custom-#/object/b/id\"]\n```\n\n\n### remove\n\n**remove** deletes any match from the input data.\nNote: the input will be modified. If this is unwanted behaviour, copy your data up front.\n\n```js\nimport { remove } from \"@sagold/json-query\";\nconst input = { object: { a: { id: 33 }, b: { id: \"id-b\" } } };\n\nremove(input, \"/object/*/id\"); // { object: { a: {}, b: {} } };\n```\n\nPer default, the input object is returned. Setting the optional argument `returnRemoved = true`, will return a list of the removed items\n\n```js\nimport { remove } from \"@sagold/json-query\";\nconst input = { object: { a: { id: 33 }, b: { id: \"id-b\" } } };\n\nremove(input, \"/object/*/id\", true); // [ 33, \"id-b\" ]\n```\n\n\n### set\n\n**set** inserts given input-value on result and creates missing properties and arrays.\nNote: Any expanding queries like `*` or patterns will not create any intermediate values\n\n`set` has the following signature\n\n```ts\nset(input:any, query:string, value:string\\|function, force?:string): any\n```\n\ninstead of value, you can also pass a function to generate the values to set:\n\n```ts\nvalue(pointerOfParent:string, lastPropertyName:string, parentObject:string, pointerAtValue:string): any\n```\n\n\nCreate data from simple properties\n\n```js\nimport { set } from \"@sagold/json-query\";\n\nconst result = set({}, \"/object/id\", 42); // { object: { id: 42 }}\n```\n\nAdd properties to multiple existing objects\n\n```js\nimport { set } from \"@sagold/json-query\";\n\nconst result = set({ list: [ { id: 1 }, { id: 2 } ] }, \"/list/*/index\", 42);\n// { list: [ { id: 1, index: 42 }, { id: 2, index: 42 } ] }\n```\n\nOr using a value-function\n\n```js\nimport { set } from \"@sagold/json-query\";\n\nconst result = set({ list: [ { id: 1 }, { id: 2 } ] }, \"/list/*/index\",\n    ( _, _, parent) => `id-${parent.id}`\n);\n// { list: [ { id: 1, index: \"id-1\" }, { id: 2, index: \"id-2\" } ] }\n```\n\nCurrently, `set` will not override simple values\n\n```js\nimport { set } from \"@sagold/json-query\";\n\nconst result = set({ value: 2 }, \"/value/id\", 3);\n// { value: 2 }\n```\n\nAnd queries will not add values to the data\n```js\nimport { set } from \"@sagold/json-query\";\n\nconst result = set({ a: { id: 2 } }, \"((/a), (/b))/id\", true);\n// { a: { id: true } }\n```\n\nWhen working with arrays, you have to choose between the following actions\n\n- insert item at index *1*: `/list/[1]/id`\n- replace item at index *1*: `/list/1/id`\n- append item `/list/[]/id`\n\nUsing the `force` option, you can enforce insertion or replacement, independent of the syntax (same for the whole query)\n\n```js\nset(data, \"/list/[1]/id\", 42, set.REPLACE_ITEMS); // will always replace index\n// and\nset(data, \"/list/1/id\", 42, set.INSERT_ITEMS); // will always insert at index\n```\n\nNumbers will always be interpreted as arrays\n\n```js\nset({}, \"/list/0/id\", 42); // { list: [{ id: 42 }]}\nset({}, \"/list/[]/id\", 42); // { list: [{ id: 42 }]}\nset({}, \"/list/[0]/id\", 42); // { list: [{ id: 42 }]}\n\n// but setting an index is respected\nset({}, \"/list/2/id\", 42); // { list: [undefined, undefined, { id: 42 }]}\n```\n\nIn order to treat numbers as objects, escape them using double-quotes\n\n```js\nset({}, '/list/\"2\"/id', 42); // { list: { 2: { id: 42 } } }\n// or \"/list/\\\"2\\\"/id\"\n```\n\n\n## About patterns\n\nPattern-queries enable selection of recursive patterns and offer a way to build up a collection of data for further filterung. A pattern uses brackets `()` to identify repeatable structures and offers multiple selections for the same data-entry.\n\nUsing a pattern-query like `#/tree((/left),(/right))*` will recursively select all *left* and *right*-nodes. e.g.\n\n```js\nconst data = {\n  tree: {\n    left: {\n      id: \"1\",\n      left: { id: \"2\" },\n      right: { id: \"3\" }\n    },\n    right: {\n      id: \"4\"\n    }\n  }\n};\n\nconst result = get(data, \"#/tree((/left),(/right))*/id\");\n// [\"1\", \"2\", \"3\", \"4\"]\n```\n\n**Note** that each pattern-queries is resovled using `query.get` and thus supports all mentioned features.\n\nOne use-case for pattern-queries can be found in json-schema specification. Any definition in `#/defs` may reference itself or be referenced circular. A linear query cannot describe the corresponding data, but pattern-queries might be sufficient.\n\n\n#### details\n\nA pattern is a simple group defined by brackets: `#/a(/b)/c`, which is identical to `#/a/b/c`. But a group may also have a quantifier `+`: `#/a(/b)+/c`. Using a quantifier, the query within the pattern will be applied as long as it matches any data. Its combined result will then be passed to `/c`.\n\ne.g. applying the pattern `#/a(/b)+/c` on the following input data:\n\n```js\nconst input = {\n  a: {\n    b: {\n      c: \"1\",\n      b: {\n        c: \"2\",\n        b: {}\n      }\n    }\n  }\n};\n```\n\nwill first select property `a` and then repeatedly select property `b`: `[a/b, a/b/b, a/b/b/b]`. This result is filtered by `c`, which will return `[\"1\", \"2\"]` (the last `b`-object has no property `c`).\n\nPatterns can also be used for **OR**-operations. An *OR* is identified by a semicolon `,` and must be within and between patterns, like `((/a/b),(/c))`. **Not valid** patterns are *(/a/b, /c)* and *r/(/a/b),(/c)/f*.\n\nCurrently, using **OR** is *commutative* in a sense that `((/a),(/b)) = ((/b),(/a))`, (with a different ordering of the resulting set), *distributive* so that `/a((/b), (/c)) = ((/a/b), (/a/c))`. **Parenthesis** without a quantifier are *associative*, e.g. `#/a/b/c = #/a(/b)/c = #/a(/b/c) = #/a(/b)(/c)`. Thus, a pattern `((/b)(/c))+` can also be written like `(/b/c)+`.\n\n\n## further examples\n\nfor further examples refer to the unit tests\n\n- [query.delete](https://github.com/sagold/json-query/blob/master/test/unit/delete.test.js)\n- [query.get](https://github.com/sagold/json-query/blob/master/test/unit/get.test.js)\n- [query.set](https://github.com/sagold/json-query/blob/master/test/unit/set.test.js)\n- [query.split](https://github.com/sagold/json-query/blob/master/test/unit/split.test.js)\n\n\n## Breaking Changes\n\n- with version `v5.0.0` package has been rename to `@sagold/json-query`\n- with version `v4.0.0` (2019/10/01)\n    - the api has been simplified to methods `query.get` and `query.delete` (removed `run` and `pattern`)\n- with version `v3.0.0`\n    - the syntax has changed to es6, which might require code transpilation\n    - queries for root-pointer (`#`, `#/`, `/`) now callback root object with `(rootObject, null, null, \"#\")`\n- with `v2.0.0` a negated filter (lookahead), e.g. `*?valid:!true` will not return objects where `valid === undefined`. To match objects with missing properties you can still query them explicitly with `*?valid:!true||valid:undefined`\n","maintainers":[{"name":"sagold","email":"noreply@saschagoldhofer.de"}],"time":{"modified":"2024-04-02T07:51:20.897Z","created":"2016-11-13T20:22:30.168Z","1.0.0":"2016-11-13T20:22:30.168Z","6.0.0":"2022-12-04T21:27:52.767Z","6.1.0":"2023-07-01T08:19:25.683Z","6.1.1":"2023-07-03T21:17:28.485Z","6.1.3":"2024-03-26T23:19:09.142Z","6.2.0":"2024-04-02T07:51:20.746Z"},"keywords":["query","json","json-query","glob-pattern","library","make my day"],"author":{"name":"Sascha Goldhofer","email":"github@saschagoldhofer.de","url":"https://github.com/sagold/"},"license":"MIT","readmeFilename":"README.md","homepage":"https://github.com/sagold/json-query#readme","repository":{"type":"git","url":"git+https://github.com/sagold/json-query.git"},"bugs":{"url":"https://github.com/sagold/json-query/issues"}}