{"_id":"object-traversal","_rev":"6-5833e139a6a56937ad121505e677924b","name":"object-traversal","dist-tags":{"latest":"1.0.1","beta":"1.0.0-beta.1"},"versions":{"0.1.0":{"name":"object-traversal","author":{"name":"Devimal"},"module":"dist/lib.esm.js","version":"0.1.0","license":"MIT","main":"dist/index.js","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test","test:watch":"tsdx test --watch","test:cov":"tsdx test --coverage","test:clear":"tsdx test --clearCache","lint":"tsdx lint","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"typings":"dist/index.d.ts","np":{"yarn":true,"contents":"dist"},"engines":{"node":">=10"},"peerDependencies":{},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"size-limit":[{"path":"dist/lib.cjs.production.min.js","limit":"10 KB"},{"path":"dist/lib.esm.js","limit":"10 KB"}],"dependencies":{},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.2","@types/benchmark":"^2.1.0","benchmark":"^2.1.4","husky":"^5.1.0","size-limit":"^4.9.2","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.5"},"resolutions":{"**/@typescript-eslint/eslint-plugin":"^4.11.1","**/@typescript-eslint/parser":"^4.11.1","**/jest":"^26.6.3","**/ts-jest":"^26.4.4","**/typescript":"^4.1.5"},"description":"Simple, performant and customizable utility for traversing and applying callback functions to any portion of a javascript object.","licenseText":"MIT License\n\nCopyright (c) 2021 DevimalPlanet\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"object-traversal@0.1.0","dist":{"shasum":"c35a78e4befa236820d821a68ab8d3059dce7ecb","integrity":"sha512-E/pQsm2HTet1iAqQihSp2kxfjOgCBW2Nkl0ZfuQJeCGe6lcOBt4SYkas57WfiCx5aDkqrn0zDvEnHrfXUIaoYQ==","tarball":"https://registry.npmjs.org/object-traversal/-/object-traversal-0.1.0.tgz","fileCount":15,"unpackedSize":18193,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgPCTnCRA9TVsSAnZWagAA9ZkQAKQ/WBSHRFailmB+MADj\n/G00EsQFd+9KgMxDgZP87S//mGZNmpOcxyFCz1QAL6gob0pSW/XFOi4jnycS\nAz8EuPZgURbkYljvGNghs2vkdVizwsewvTSIYZg92W7qZ+QMZ9wBLDyKCYej\nUYUlew1xOEGvGV2psyltfLw0xHnwz77KjHA6lop9mKmKRD8b3GQXpTKML5J0\nyLVylTZCbJCeipUdCQytbcMqX/zM+dNic9pni23dhHOQt0RdFNIj8in1rObx\nGwvjW4AmT/1o7+Mm/uAG5jMbrGTpaM779VsD80hFV/1zYbtVl+vZRunN6Z6d\nf07OWWyWNaC4lNHy/pNnvbqsOBbP/3A6rQem9x7yWYBo3W1ONV82F42nTeyt\n3wX6DIuq6/zBI8h8DHmOUvHIWc0eUqEJTZMrQspls+MiEavvd70Oe+gRDnZr\nMBnUXREiqgMEUZuKIRvHtrwh18YJaeVDewBAqrVN/I3wwtW+ftUoi7lznCqM\nESYB/OQKswdMMibVoGzdhG+ECdli3VH3l4OOJqr2YnSoQ4R2DyHRla35Oy0o\n+ytZuUi35DZT9iCTziT88NF/4r9Q5QGDC/rJRIKTaRqcCD7F4iZ1gUKnM45W\nPbPHJiY3kdVmZMiqerhJxnUHL6aKjKPnS2XbYT1otx4AjwyVJ98D+tT+uhmr\nz9oj\r\n=AGnU\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZ/s1cyQYTioUu3M3ryctd/Y4gnLqKgIht0l2xnGrUZAIgKnQwPeyUzykpdhsF9BXY4mr42SSWb2evOqTkcVaoO5E="}]},"_npmUser":{"name":"devimal","email":"devimalplanet@gmail.com"},"directories":{},"maintainers":[{"name":"devimal","email":"devimalplanet@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/object-traversal_0.1.0_1614554342717_0.7289864392512071"},"_hasShrinkwrap":false},"0.1.1":{"name":"object-traversal","author":{"name":"Devimal"},"module":"dist/lib.esm.js","version":"0.1.1","license":"MIT","main":"dist/index.js","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test","test:watch":"tsdx test --watch","test:cov":"tsdx test --coverage","test:clear":"tsdx test --clearCache","lint":"tsdx lint","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"typings":"dist/index.d.ts","np":{"yarn":true,"contents":"dist"},"engines":{"node":">=10"},"peerDependencies":{},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"size-limit":[{"path":"dist/lib.cjs.production.min.js","limit":"10 KB"},{"path":"dist/lib.esm.js","limit":"10 KB"}],"dependencies":{},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.2","@types/benchmark":"^2.1.0","benchmark":"^2.1.4","husky":"^5.1.0","size-limit":"^4.9.2","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.5"},"resolutions":{"**/@typescript-eslint/eslint-plugin":"^4.11.1","**/@typescript-eslint/parser":"^4.11.1","**/jest":"^26.6.3","**/ts-jest":"^26.4.4","**/typescript":"^4.1.5"},"repository":{"type":"git","url":"https://github.com/DevimalPlanet/object-traversal.git"},"description":"Simple, performant and customizable utility for traversing and applying callback functions to any portion of a javascript object.","licenseText":"MIT License\n\nCopyright (c) 2021 DevimalPlanet\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"object-traversal@0.1.1","dist":{"shasum":"2f91410524e185ec86cc4534ef8e9a317fac51e5","integrity":"sha512-yrNVkYfmRxTxkuES3WZn6DxQqhvgQcOBKgqrHiOJ30IV1QNb6amWqKB1fStTqSWOpmJvtYmySV/BNy+PJsHJFQ==","tarball":"https://registry.npmjs.org/object-traversal/-/object-traversal-0.1.1.tgz","fileCount":15,"unpackedSize":20671,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgPDkRCRA9TVsSAnZWagAAlQ8P/2Um9LH3ENrq85+iBuXi\ntgKqbSHx8rPT6M7fouE/E2AfPSyTeWnE3Ev/TZQCHCbR/QFFqwJ46jAuSVOV\nIQfiQMJ2trGmyO1TZUCTu1QkLJZe9dPDLfm9eBc1xU9tjeKs1F8110nEdnRr\nXEvPwciaL771Ji4yowSV7ZXGwq4kNgeWPZCuHfKx5Ro93YIAOxbMmKFKMoPa\nJnEMSD4ahAAgYYowme6UpWUBVaQLwOQ6o3P5EQE0YvuOISDpo+A1t8mhTatk\nx96aBgyLkyxtLxaOrijWL8jky2E3HToQvXYR0z8mdba+wg9RJ9yvbJvLaN37\nnRf5Sqpm22o7x3SOP4WWv4cIm3RU08kVCAx2o6ftJim9Xa3/po3a+DRdyYvr\npqs7YQnKSuIDaFevn7U1GJRhOtGfT7htNB+K2fF1Vc8FQcOb6/9d8cRGX4WY\nXdNHRmUnnsDRF+zx7m9/JB/XnrvP5utouaBwbWy5BQZAycSYIgIcKhB1vKb/\n1y8rTWQypH7cdeDhNUDN186a2gCFAMI57Al9z8FqhITIyl3g+MF279hnTf9T\nhGOZ2ntnbxSvimMof4pFO2jFsdimypyr2PvxQW/PzDTYfkzjQ/hyVz0bK+Vj\n68EV6y8otThTz4CFQAhU2ePbnMIqDGFfja8/8c2QDIjkhyuLb8qTJ34SI+Gn\nFnzc\r\n=82D3\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDgGtUgMEG0gzKJOvh0NLeVUnTtPHyUSXgTzpt2dj+p3AIhAMk/3kJBSUgF+X16vVRcPzj/vw8Zw33OFttlAjEBXOpK"}]},"_npmUser":{"name":"devimal","email":"devimalplanet@gmail.com"},"directories":{},"maintainers":[{"name":"devimal","email":"devimalplanet@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/object-traversal_0.1.1_1614559504888_0.12925270332916505"},"_hasShrinkwrap":false},"0.1.2":{"name":"object-traversal","author":{"name":"Devimal"},"module":"dist/lib.esm.js","version":"0.1.2","license":"MIT","main":"dist/index.js","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test","test:watch":"tsdx test --watch","test:cov":"tsdx test --coverage","test:clear":"tsdx test --clearCache","benchmark":"tsdx build && node benchmarks/object-traversal.bench.js","lint":"tsdx lint","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"typings":"dist/index.d.ts","np":{"yarn":true,"contents":"dist"},"engines":{"node":">=10"},"peerDependencies":{},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"size-limit":[{"path":"dist/lib.cjs.production.min.js","limit":"10 KB"},{"path":"dist/lib.esm.js","limit":"10 KB"}],"dependencies":{},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.2","@types/benchmark":"^2.1.0","benchmark":"^2.1.4","husky":"^5.1.0","size-limit":"^4.9.2","traverse":"^0.6.6","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.5"},"resolutions":{"**/@typescript-eslint/eslint-plugin":"^4.11.1","**/@typescript-eslint/parser":"^4.11.1","**/jest":"^26.6.3","**/ts-jest":"^26.4.4","**/typescript":"^4.1.5"},"repository":{"type":"git","url":"https://github.com/DevimalPlanet/object-traversal.git"},"description":"Simple, performant and customizable utility for traversing and applying callback functions to any portion of a javascript object.","licenseText":"MIT License\n\nCopyright (c) 2021 DevimalPlanet\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"object-traversal@0.1.2","dist":{"shasum":"c1676c98b6964a585f52d9da9a0f42a6543c53ae","integrity":"sha512-Q5My9GgntrOS5VrHN0d+VGN9SxjeEmZx97prSVeFVyuKSghQp3KHf0BRZOL4razE7cXvskMEuAk5BiDZhbCLag==","tarball":"https://registry.npmjs.org/object-traversal/-/object-traversal-0.1.2.tgz","fileCount":15,"unpackedSize":21435,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgPUqyCRA9TVsSAnZWagAAXNEP/i6jhKniFDOogywG/pT/\nz5fiCwew5LZCRykfFuBoayFi6wlm71kUX102pQT7gbpJTmjfFl9vOcUQEMnS\nenriTUj9DJxBLxvn3hnV6uiCbwXl89eqEDfI/Gp/cEGguMnfgqeY7v8qAyKl\nXDra0QdVnTxJBvI0b6B/8Y6l9WJ7AkLqPOSS/LhQIinYL5P+R8Ei2nF5uwRx\n5SGqLDBdTU9bXSHvH8gN2frZmlW8cij71o2rjnv1G5yjFXGO9lbiVPc5r1RL\nhF7LHA8MGjWA9rwflJY5XJ9/dl6GO7nJBn1WpOetKccBMckboiE7Ihl5bZJY\nVD8c0iIRj+NBjtsZEhK5Y+ouud4fr5ZZhcmuLLl+WmDaUzAZ2cVIYQiATpp6\n1p0jQqyNZ5naQKMV5zOi7np4a6QDDGlDa55/tAOAHNi8UTi8GBH/scqeyMq2\nZIDejWSlWxTDP8sKnnes83PpTyMihXbznQ+KkKm5wKEBq+Hz0EegRWmNsQ1G\nTrtTp+7fbXeehduVEH/PYBNzAt7NjfluiH9RxmV/Pqkk1TY2Z9UAEIiiokCS\nnf0fK6JgJFsRLSNx940lSJj4gKvalD7jd+kXEP4eVKKSoyPXeODXMjqA23Mu\nlTAKOpo5Q3/OdrmBmEsKUXQI1AwDOstuHIPeMyPie/Qv4bgf6IdnDTZMdFZg\nUUGF\r\n=raLE\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICiWPIIhGt3DrdXFsYtw6ZaWjGYePh8zePL7y2b5kszQAiBmB6A9LG3v1hM9O57A+eYPbQWfoVE+a/UtXHft+2pTOA=="}]},"_npmUser":{"name":"devimal","email":"devimalplanet@gmail.com"},"directories":{},"maintainers":[{"name":"devimal","email":"devimalplanet@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/object-traversal_0.1.2_1614629554344_0.36876604090752485"},"_hasShrinkwrap":false},"1.0.0-beta.1":{"name":"object-traversal","author":{"name":"Devimal"},"module":"dist/lib.esm.js","version":"1.0.0-beta.1","license":"MIT","main":"dist/index.js","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test","test:watch":"tsdx test --watch","test:cov":"tsdx test --coverage","test:clear":"tsdx test --clearCache","prebenchmark":"npm run build","benchmark":"npm run benchmark:node && npm run benchmark:chromium && npm run benchmark:firefox && npm run benchmark:webkit","benchmark:node":"node benchmarks/object-traversal.bench.js && node benchmarks/stack-queue.bench.js","benchmark:chromium":"npx playwright-test ./benchmarks/object-traversal.bench.js -r benchmark -b chromium","benchmark:firefox":"npx playwright-test ./benchmarks/object-traversal.bench.js -r benchmark -b firefox","benchmark:webkit":"echo \"Skipping npx playwright-test ./benchmarks/object-traversal.bench.js -r benchmark -b webkit\"","lint":"tsdx lint src test benchmarks examples/src","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"typings":"dist/index.d.ts","np":{"yarn":true,"contents":"dist"},"engines":{"node":">=10"},"peerDependencies":{},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"size-limit":[{"path":"dist/lib.cjs.production.min.js","limit":"10 KB"},{"path":"dist/lib.esm.js","limit":"10 KB"}],"dependencies":{},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.2","@types/benchmark":"^2.1.0","@types/traverse":"^0.6.32","benchmark":"^2.1.4","husky":"^5.1.0","playwright-test":"^7.2.2","size-limit":"^4.9.2","traverse":"^0.6.6","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.5"},"resolutions":{"**/@typescript-eslint/eslint-plugin":"^4.11.1","**/@typescript-eslint/parser":"^4.11.1","**/jest":"^26.6.3","**/ts-jest":"^26.4.4","**/typescript":"^4.1.5"},"repository":{"type":"git","url":"https://github.com/DevimalPlanet/object-traversal.git"},"keywords":["traverse","object","traversal","recurse","recursive","recursion","js","javascript","graph","tree","walk","walker","iterator","json","deep"],"readmeFilename":"README.md","readme":"# object-traversal\n\n<div>\n\n<a href=\"https://github.com/DevimalPlanet/object-traversal/actions/workflows/tests.yml\">\n  <img src=\"https://github.com/DevimalPlanet/object-traversal/actions/workflows/tests.yml/badge.svg\" alt=\"License\" />\n</a>\n\n<a href=\"https://codecov.io/gh/DevimalPlanet/object-traversal/branch/main/graph/badge.svg?token=JJOGZJEZBO\">\n  <img src=\"https://codecov.io/gh/DevimalPlanet/object-traversal/branch/main/graph/badge.svg?token=JJOGZJEZBO\" alt=\"License\" />\n</a>\n\n<a href=\"https://www.npmjs.com/package/object-traversal\">\n<img src=\"https://img.shields.io/npm/dm/object-traversal.svg\" alt=\"npm downloads\" />\n</a>\n\n<a href=\"https://github.com/DevimalPlanet/object-traversal/blob/master/package.json\">\n  <img src=\"https://img.shields.io/badge/dependencies-0-brightgreen\" alt=\"License\" />\n</a>\n\n<a href=\"https://github.com/DevimalPlanet/object-traversal/blob/master/LICENSE\">\n  <img src=\"https://img.shields.io/github/license/DevimalPlanet/object-traversal.svg\" alt=\"License\" />\n</a>\n\n</div>\n\n<br />\n\n<div>\nFlexible and performant utility for traversing javascript objects.\n</div>\n\n## Installation\n\n    npm i object-traversal\n\n## ✔ Features\n\n1. Performance\n   - Traverses over 20 million nodes per second. _(2020 MacBook Air)_\n   - Around 10 times faster than popular alternatives. _(`npm run benchmark`)_\n1. Configurable\n   - Tweak `traversalOpts` for even more speed, traversal order, maxDepth and more.\n1. Zero dependencies\n   - Works on both NodeJS and the browser.\n1. Big test coverage\n1. Typescript\n\n## Docs\n\n### Usage\n\n```javascript\nimport { traverse } from 'object-traversal';\n\ntraverse(object, callback, opts?);\n```\n\n### object\n\nAny instance of javascript object, cyclic or otherwise.\n\n### callback\n\nA function that will be called once for each node in the provided root `object`, including the root `object` itself.\n\nThe `callback` function has the following signature:\n\n```typescript\n// Callback function signature\nexport type TraversalCallback = (context: TraversalCallbackContext) => any;\n\n// Callback context\nexport type TraversalCallbackContext = {\n  parent: ArbitraryObject | null; // parent is null when callback is being called on the root `object`\n  key: string | null; // key is null when callback is being called on the root `object`\n  value: any;\n  meta: {\n    nodePath?: string | null;\n    visitedNodes: WeakSet<ArbitraryObject>;\n    depth: number;\n  };\n};\n```\n\n### opts\n\nAn optional configuration object. See below for the available options and their default values.\n\n```typescript\nexport type TraversalOpts = {\n  /**\n   * Default: 'depth-first'\n   */\n  traversalType?: 'depth-first' | 'breadth-first';\n\n  /**\n   * Traversal stops when the traversed node count reaches this value.\n   *\n   * Default: Number.Infinity\n   */\n  maxNodes?: number;\n\n  /**\n   * If set to `true`, prevents infinite loops by not re-visiting repeated nodes.\n   *\n   * Default: true\n   */\n  cycleHandling?: boolean;\n\n  /**\n   * The maximum depth that must be traversed.\n   *\n   * Root object has depth 0.\n   *\n   * Default: Number.Infinity\n   */\n  maxDepth?: number;\n\n  /**\n   * If true, traversal will stop as soon as the callback returns a truthy value.\n   *\n   * This is useful for search use cases, where you typically want to skip traversing the remaining nodes once the target is found.\n   *\n   * Default: false\n   */\n  haltOnTruthy?: boolean;\n\n  /**\n   * The string to be used as separator for the `meta.nodePath` segments.\n   *\n   * Set to null if you wish to turn off `meta.nodePath` to increase traversal speed.\n   *\n   * Default: '.'\n   */\n  pathSeparator?: string | null;\n};\n```\n\n## Examples\n\n### Double all numbers in-place\n\n<details>\n  <summary>Click to expand</summary>\n\n```javascript\nexampleObject = {\n  name: 'Hello World!',\n  age: 1,\n  accounts: 2,\n  friends: 3,\n};\n```\n\n</details>\n\n```javascript\nfunction double({ parent, key, value, meta }) {\n  if (typeof value === 'number') {\n    parent[key] = value * 2;\n  }\n}\n\ntraverse(exampleObject, double);\n\nconsole.log(exampleObject);\n// {\n//   name: 'Hello World!',\n//   age: 2,\n//   accounts: { checking: 4, savings: 6 },\n//   friends: 8\n// }\n```\n\n### Find deep nested values by criteria\n\n<details>\n  <summary>Click to expand</summary>\n\n```javascript\nnetwork = {\n  name: 'Person1',\n  age: 52,\n  friends: [\n    {\n      name: 'Person2',\n      age: 25,\n      friends: [],\n    },\n    {\n      name: 'Person3',\n      age: 42,\n      friends: [\n        {\n          name: 'Person4',\n          age: 18,\n          friends: [\n            {\n              name: 'Person5',\n              age: 33,\n              friends: [],\n            },\n          ],\n        },\n      ],\n    },\n  ],\n};\n```\n\n</details>\n\n```javascript\nconst numbersOver25 = [];\n\nfunction collectOver25({ parent, key, value, meta }) {\n  if (key === 'age' && value > 25) {\n    numbersOver25.push(value);\n  }\n}\n\ntraverse(network, collectOver25);\n\nconsole.log(numbersOver25);\n// [ 52, 42, 33 ]\n```\n\n### Find paths by criteria\n\n<details>\n  <summary>Click to expand</summary>\n\n```javascript\nnetwork = {\n  name: 'Alice Doe',\n  age: 52,\n  friends: [\n    {\n      name: 'John Doe',\n      age: 25,\n      friends: [],\n    },\n    {\n      name: 'Bob Doe',\n      age: 42,\n      friends: [\n        {\n          name: 'John Smith',\n          age: 18,\n          friends: [\n            {\n              name: 'Charlie Doe',\n              age: 33,\n              friends: [],\n            },\n          ],\n        },\n      ],\n    },\n  ],\n};\n```\n\n</details>\n\n```javascript\nconst pathsToPeopleNamedJohn = [];\n\nfunction callback({ parent, key, value, meta }) {\n  if (value.name && value.name.startsWith('John')) {\n    pathsToPeopleNamedJohn.push(meta.nodePath);\n  }\n}\n\ntraverse(network, callback);\n\nconsole.log(pathsToPeopleNamedJohn);\n// [ 'friends.0', 'friends.1.friends.0' ]\n```\n\n### Get node by path\n\n<details>\n  <summary>Click to expand</summary>\n\n```javascript\nnetwork = {\n  name: 'Alice Doe',\n  age: 52,\n  friends: [\n    {\n      name: 'John Doe',\n      age: 25,\n      friends: [],\n    },\n    {\n      name: 'Bob Doe',\n      age: 42,\n      friends: [\n        {\n          name: 'John Smith',\n          age: 18,\n          friends: [\n            {\n              name: 'Charlie Doe',\n              age: 33,\n              friends: [],\n            },\n          ],\n        },\n      ],\n    },\n  ],\n};\n```\n\n</details>\n\n```javascript\nimport { getNodeByPath } from 'object-traversal';\n\nconst firstFriend = getNodeByPath(network, 'friends.0');\nconsole.log(firstFriend);\n// { name: 'John Doe', age: 25, friends: [] }\n```\n\n### Breadth-first traversal\n\n<details>\n  <summary>Click to expand</summary>\n\n```javascript\nnetwork = {\n  name: 'Person 1',\n  age: 52,\n  friends: [\n    {\n      name: 'Person 2',\n      age: 42,\n      friends: [\n        {\n          name: 'Person 4',\n          age: 18,\n          friends: [],\n        },\n      ],\n    },\n    {\n      name: 'Person 3',\n      age: 25,\n      friends: [],\n    },\n  ],\n};\n```\n\n</details>\n\n```javascript\nlet names = [];\n\nfunction getName({ parent, key, value, meta }) {\n  if (value.name) {\n    names.push(value.name);\n  }\n}\n\ntraverse(network, getName, { traversalType: 'breadth-first' });\n\nconsole.log(names);\n// [ 'Person 1', 'Person 2', 'Person 3', 'Person 4' ]\n```\n\n## Roadmap\n\n- [x] Configurable BFS/DFS\n- [x] Max depth\n- [x] Configurable path separator\n- [x] Utility for consuming paths\n- [x] Toggleable cycle handler\n- [ ] Iterator support\n- [ ] Sequential promise support\n- [ ] Multi threading & further speed enhancements\n- [ ] Streaming research\n- [ ] More granular cycleHandling: 'revisit', 'norevisit', and 'off'\n\n## Built with\n\n[TSDX](https://github.com/formium/tsdx)<br>\n[np](https://github.com/sindresorhus/np)<br>\n[yarn 1.22.10](https://yarnpkg.com/)\n","description":"<div>","licenseText":"MIT License\n\nCopyright (c) 2021 DevimalPlanet\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"object-traversal@1.0.0-beta.1","dist":{"shasum":"8cba8d5ae0c53c7dc3b0f6d1b75ba4a0fa379e82","integrity":"sha512-INCwNAMxo3CerQ7lzGusEFLn7GbskAbRzeqYreUGi9vGOfgIrvj6hIwMnMvJFIeg/KjPWwx1sBLqnIKJB2ji7A==","tarball":"https://registry.npmjs.org/object-traversal/-/object-traversal-1.0.0-beta.1.tgz","fileCount":27,"unpackedSize":69850,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiHCG/ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmqOzhAAnYefMQl3z/KLWyV9xeI3VaVDfEZx+qCl5Ibxjm+I8KrfEoSD\r\nZtiDjdmSkC9RQgLCm14FOED59uCUkW3ca8ExSbhppWfnCUw0IV8BPRBO4Sa3\r\n/cxKvWMBmdoCLsDNJRkxN6zPUxz2SbPstD+KBij9BU9GA7h2PHc7bBYbIyrL\r\n0k/2CojsMpv3xxJZlS2c/dyMiPtZsglA/V+I5CO6NXtOUPsDNOkRmS1F31uE\r\nZ8G9Q9B5HccCGKo44ckVZRWb0e5Vz3s2g2+zdyJPq7JgfKQblU12c4RvtUz6\r\nf/OaEVG4+SVlpBt1lJjNIwKSwzxpOk/zjbpzxle533CvuYdHMGCMXSMotFfU\r\n4MEniTRik6Jk/KzhKpVTAf4P5/etiUve918BdrLoEilu+WIoasz+7AxLRkZT\r\nWLLW8flBlwEX+DgeUgXUNYoyJjvezJhcMcgLXj9jxyNDEwZMSi6ij+Zv7uCl\r\n6Rq+mdsA74hGOaOCy+QzM9Yb/5b6dE90ppRjCLv9ZSfP4Uh/uD9n+lbONjkh\r\nqP62CQTBX+Pqm9luhXK35e7YN6kSJRLyJMR+JYUywp+wjBUZFGMU6bJ/qtDT\r\nPSPlRq1b4pVO/a9lBSm/iMLClHXYqUwVMWhJ/JtkBoS9/Nnsat3D1iJeJ42u\r\nwuBwiTghcIxk/j7lKdj3OQkbImg9bcKFwgg=\r\n=vYYL\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH7xW0bObXQXWLhkeoH8yBsmDLTX5W9Q7LeqZaM/u/J7AiBvuXHpw0e9WoqTQPgUKm6hIZQbsf8tJKr0zMZcez4vfA=="}]},"_npmUser":{"name":"devimal","email":"devimalplanet@gmail.com"},"directories":{},"maintainers":[{"name":"devimal","email":"devimalplanet@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/object-traversal_1.0.0-beta.1_1646010815296_0.3718972126245188"},"_hasShrinkwrap":false},"1.0.0":{"name":"object-traversal","author":{"name":"Devimal"},"module":"dist/lib.esm.js","version":"1.0.0","license":"MIT","main":"dist/index.js","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test","test:watch":"tsdx test --watch","test:cov":"tsdx test --coverage","test:clear":"tsdx test --clearCache","prebenchmark":"npm run build","benchmark":"npm run benchmark:node && npm run benchmark:chromium && npm run benchmark:firefox && npm run benchmark:webkit","benchmark:node":"node benchmarks/object-traversal.bench.js && node benchmarks/stack-queue.bench.js","benchmark:chromium":"npx playwright-test ./benchmarks/object-traversal.bench.js -r benchmark -b chromium --timeout 60000","benchmark:firefox":"npx playwright-test ./benchmarks/object-traversal.bench.js -r benchmark -b firefox --timeout 60000","benchmark:webkit":"echo \"Skipping npx playwright-test ./benchmarks/object-traversal.bench.js -r benchmark -b webkit --timeout 60000\"","lint":"tsdx lint src test benchmarks examples/src","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"typings":"dist/index.d.ts","np":{"yarn":true,"contents":"dist"},"engines":{"node":">=10"},"peerDependencies":{},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"size-limit":[{"path":"dist/lib.cjs.production.min.js","limit":"10 KB"},{"path":"dist/lib.esm.js","limit":"10 KB"}],"dependencies":{},"devDependencies":{"@size-limit/preset-small-lib":"^4.9.2","@types/benchmark":"^2.1.0","@types/traverse":"^0.6.32","benchmark":"^2.1.4","husky":"^5.1.0","playwright-test":"^7.2.2","size-limit":"^4.9.2","traverse":"^0.6.6","tsdx":"^0.14.1","tslib":"^2.1.0","typescript":"^4.1.5"},"resolutions":{"**/@typescript-eslint/eslint-plugin":"^4.11.1","**/@typescript-eslint/parser":"^4.11.1","**/jest":"^26.6.3","**/ts-jest":"^26.4.4","**/typescript":"^4.1.5"},"repository":{"type":"git","url":"https://github.com/DevimalPlanet/object-traversal.git"},"keywords":["traverse","object","traversal","recurse","recursive","recursion","js","javascript","graph","tree","walk","walker","iterator","json","deep"],"description":"<div>","licenseText":"MIT License\n\nCopyright (c) 2021 DevimalPlanet\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"object-traversal@1.0.0","dist":{"shasum":"55da740085540685cf306e6663b243dfe227aa9f","integrity":"sha512-oc9JRLVwTU0xS5BxGybWhNxYNClYZOEoRnovEqrJYaQmxgRZMCHe327HPrjB8vrvGC8Kr2kySK1cyt+1EC6I6g==","tarball":"https://registry.npmjs.org/object-traversal/-/object-traversal-1.0.0.tgz","fileCount":27,"unpackedSize":69891,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiHCa9ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpbUA//SLVcsy3Jh2uPFpHm+8Ci37kps4gQFd2/XUEj4jEjO1BfRNr5\r\nxcU9+QX+DJ2Wp4K/jnOhtSLxLov5qzrWCDGd/kJxirh3dXgm8Zkg+zn6oJe0\r\n6vgU+bMr3DZpWRvBbCg1GuZZshRnvIES15OumfEu4uX5DMEBQ5dMng93UIP4\r\nA0z+vvk5GrITF12irhpVkrAqt8sCbjmxt5bUQv+nTxdg02UDQ2BhUC6BM1vI\r\nb796ENslnya7xJJd+Uc8m/wFPZBQLjd507VGyGhXhZrD664tx2NizjCFSjtO\r\nVOy76jMBJohjY0Ij+1U1QmLr0UXsl0GpTqsCS38qLKGFd7KCXy/uKwSJoQKn\r\nZbP9f+GGvjtIRbk6Slc/9k53vePnkec4gmGG6vkWqaJUCI832VjCiFiOSqtU\r\nUlFxTHMX2A2Em6JavrNQ2+jAVWrvsE0wGwAcLF88fvu8TMaifukXJG20rtb/\r\nTprygm2J/LznfOHYgz1ht6yUbbuSsrQJyy/6+ji/5HrUmcOy0u1vSvcn5Bej\r\ncIOlO4Gy5UcHDWdtp7Va3RH+T69nbdbNnE8rfKsylydc5ehiqXYf6mP+MGVV\r\nhbHcfv8sZYxKCXLrkbji0Yu4kwKHxdT6uwYQvFiHWnFB8T4h8kW8SYGDg9If\r\nqDVbhE6YvWKI4z2/Mtau8QiXZ03okTKu3v8=\r\n=N1ZC\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIHsuxFIMsuuDAV/stZ8PwAHPAHJ2EUr2d8KALaX9fSNQAiBmjyG3RNHQ7o9vYsmuJOWxO5QbDqcZPMUzh7ON0f2KaQ=="}]},"_npmUser":{"name":"devimal","email":"devimalplanet@gmail.com"},"directories":{},"maintainers":[{"name":"devimal","email":"devimalplanet@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/object-traversal_1.0.0_1646012093414_0.5615491145109961"},"_hasShrinkwrap":false},"1.0.1":{"name":"object-traversal","description":"Flexible and performant utility for traversing javascript objects","author":{"name":"Devimal"},"module":"dist/object-traversal.esm.js","version":"1.0.1","license":"MIT","main":"dist/index.js","scripts":{"start":"tsdx watch","build":"tsdx build","test":"tsdx test","test:watch":"tsdx test --watch","test:cov":"tsdx test --coverage","test:clear":"tsdx test --clearCache","prebenchmark":"npm run build","benchmark":"npm run benchmark:node && npm run benchmark:chromium && npm run benchmark:firefox && npm run benchmark:webkit || echo 'WARNING: some of the benchmarks did not finish. See logs above.'","benchmark:node":"node benchmarks/object-traversal.bench.js && node benchmarks/stack-queue.bench.js","benchmark:chromium":"npx playwright-test ./benchmarks/object-traversal.bench.js -r benchmark -b chromium --timeout 60000","benchmark:firefox":"npx playwright-test ./benchmarks/object-traversal.bench.js -r benchmark -b firefox --timeout 60000","benchmark:webkit":"echo \"Skipping npx playwright-test ./benchmarks/object-traversal.bench.js -r benchmark -b webkit --timeout 60000\"","lint":"tsdx lint src test benchmarks examples/src","prepare":"tsdx build","size":"size-limit","analyze":"size-limit --why"},"typings":"dist/index.d.ts","np":{"yarn":true,"contents":"dist"},"engines":{"node":">=10"},"peerDependencies":{},"husky":{"hooks":{"pre-commit":"tsdx lint"}},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"size-limit":[{"path":"dist/object-traversal.cjs.production.min.js","limit":"10 KB"},{"path":"dist/object-traversal.esm.js","limit":"10 KB"}],"dependencies":{},"devDependencies":{"@size-limit/preset-small-lib":"7.0.8","@types/benchmark":"2.1.1","@types/traverse":"0.6.32","benchmark":"2.1.4","husky":"7.0.4","playwright-test":"7.3.0","size-limit":"7.0.8","traverse":"0.6.6","tsdx":"0.14.1","tslib":"2.3.1","typescript":"4.6.3"},"resolutions":{"**/@typescript-eslint/eslint-plugin":"^5.0.0","**/@typescript-eslint/parser":"^5.0.0","**/jest":"^26.6.3","**/ts-jest":"^26.4.4","**/typescript":"4.6.3"},"repository":{"type":"git","url":"https://github.com/DevimalPlanet/object-traversal.git"},"keywords":["traverse","object","traversal","recurse","recursive","recursion","js","javascript","graph","tree","walk","walker","iterator","json","deep"],"licenseText":"MIT License\n\nCopyright (c) 2021 DevimalPlanet\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","_id":"object-traversal@1.0.1","dist":{"shasum":"9803bebf619c1ac514fcf6c698cd1037998ceb38","integrity":"sha512-aLXtM9kbcG/ePyZfB45B0FrIdu1yy3udQjIVmp2IVl2np52dBK5ZZBhdyUKFT6neCutwDhCW/kQ+e/0K5n/Jhw==","tarball":"https://registry.npmjs.org/object-traversal/-/object-traversal-1.0.1.tgz","fileCount":27,"unpackedSize":69764,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiPktnACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmp2QQ//Wf0TE4QvcrBNAsG1eUSjE4Ws8OcY+/LlNYsz+S8gBEMgta47\r\nesaKDlHbxtD3bvDQdyYLrdH4SgdUPb1jsux2OY4xvvxaaTUxSuXFAE2x5FzG\r\nOg0VCOH4U92mPE6P1jySZTSF67yU4wESQ54oQryk/SfLMsZAWuu49fUiqisH\r\n5ylp3/E9jzpU2Kxp0bsfBLAKlJ1pvLUY9pFdBfRCW4vYX6KKlAqBamrdDrHF\r\nmNA7UBZ2r5kY90JWVwd4tXNo9IYS7Dk2wJ0XrGbafg3cFUYDZBcd0pYwPf37\r\nvu/uuGjAT8MGjvXFC6NSUXKDIdiKKCnp1NNJW5M7/OkHCatsVi5/097EE2Sk\r\nIDySPEuhB9LCLaYlBOcxIp5C89zDC26yuIEC8nKG1lzp3eLa04Kn6PgnJzg3\r\nHijcigKwtAASW4OX3OqGyQmBHqemGZfZ5BS8ITFoH2ASgbZAtLAJwzcXy3kB\r\nb69fT8+S/e6ZVZXKmnz8ku6GiRybwsFAsvEkfysxI5Wm5RcZujND7J8q+emr\r\nAWM9aAxulbPPkXu0Jf41SKBEJLLVxRZokGgSvOA2lyQTwz9+m3pqiydB1mgt\r\nxtmwcFxjdMfKlQ3C1+XcDOWT7b5SNdiTAj4Ku53vbNr5AcEV5lUsWJCe/qy8\r\np7r1/q8TNDsHwfCHqx+srNwrCFMS6Kdf0Yw=\r\n=LS9N\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDKUxeBDcX+rJ7ujhy73g/u/w+8/2jrFi2wZXk+L+lLIgIgEig5azUZHLc4/7aaFMUoDGdV+2oAMNnrk0xWe9p2UFo="}]},"_npmUser":{"name":"devimal","email":"devimalplanet@gmail.com"},"directories":{},"maintainers":[{"name":"devimal","email":"devimalplanet@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/object-traversal_1.0.1_1648249702859_0.9805433042299334"},"_hasShrinkwrap":false}},"time":{"created":"2021-02-28T23:19:02.716Z","0.1.0":"2021-02-28T23:19:02.882Z","modified":"2022-05-12T01:06:37.094Z","0.1.1":"2021-03-01T00:45:05.102Z","0.1.2":"2021-03-01T20:12:34.496Z","1.0.0-beta.1":"2022-02-28T01:13:35.655Z","1.0.0":"2022-02-28T01:34:53.556Z","1.0.1":"2022-03-25T23:08:23.037Z"},"maintainers":[{"name":"devimal","email":"devimalplanet@gmail.com"}],"description":"Flexible and performant utility for traversing javascript objects","author":{"name":"Devimal"},"license":"MIT","readme":"# object-traversal\n\n<div>\n\n<a href=\"https://github.com/DevimalPlanet/object-traversal/actions/workflows/tests.yml\">\n  <img src=\"https://github.com/DevimalPlanet/object-traversal/actions/workflows/tests.yml/badge.svg\" alt=\"License\" />\n</a>\n\n<a href=\"https://codecov.io/gh/DevimalPlanet/object-traversal/branch/main/graph/badge.svg?token=JJOGZJEZBO\">\n  <img src=\"https://codecov.io/gh/DevimalPlanet/object-traversal/branch/main/graph/badge.svg?token=JJOGZJEZBO\" alt=\"License\" />\n</a>\n\n<a href=\"https://www.npmjs.com/package/object-traversal\">\n<img src=\"https://img.shields.io/npm/dm/object-traversal.svg\" alt=\"npm downloads\" />\n</a>\n\n<a href=\"https://github.com/DevimalPlanet/object-traversal/blob/master/package.json\">\n  <img src=\"https://img.shields.io/badge/dependencies-0-brightgreen\" alt=\"License\" />\n</a>\n\n<a href=\"https://github.com/DevimalPlanet/object-traversal/blob/master/LICENSE\">\n  <img src=\"https://img.shields.io/github/license/DevimalPlanet/object-traversal.svg\" alt=\"License\" />\n</a>\n\n</div>\n\n<br />\n\n<div>\nFlexible and performant utility for traversing javascript objects.\n</div>\n\n## Installation\n\n    npm i object-traversal\n\n## ✔ Features\n\n1. Performance\n   - Traverses over 20 million nodes per second. _(2020 MacBook Air)_\n   - Around 10 times faster than popular alternatives. _(`npm run benchmark`)_\n1. Configurable\n   - Tweak `traversalOpts` for even more speed, traversal order, maxDepth and more.\n1. Zero dependencies\n   - Works on both NodeJS and the browser.\n1. Big test coverage\n1. Typescript\n\n## Docs\n\n### Usage\n\n```javascript\nimport { traverse } from 'object-traversal';\n\ntraverse(object, callback, opts?);\n```\n\n### object\n\nAny instance of javascript object, cyclic or otherwise.\n\n### callback\n\nA function that will be called once for each node in the provided root `object`, including the root `object` itself.\n\nThe `callback` function has the following signature:\n\n```typescript\n// Callback function signature\nexport type TraversalCallback = (context: TraversalCallbackContext) => any;\n\n// Callback context\nexport type TraversalCallbackContext = {\n  parent: ArbitraryObject | null; // parent is null when callback is being called on the root `object`\n  key: string | null; // key is null when callback is being called on the root `object`\n  value: any;\n  meta: {\n    nodePath?: string | null;\n    visitedNodes: WeakSet<ArbitraryObject>;\n    depth: number;\n  };\n};\n```\n\n### opts\n\nAn optional configuration object. See below for the available options and their default values.\n\n```typescript\nexport type TraversalOpts = {\n  /**\n   * Default: 'depth-first'\n   */\n  traversalType?: 'depth-first' | 'breadth-first';\n\n  /**\n   * Traversal stops when the traversed node count reaches this value.\n   *\n   * Default: Number.Infinity\n   */\n  maxNodes?: number;\n\n  /**\n   * If set to `true`, prevents infinite loops by not re-visiting repeated nodes.\n   *\n   * Default: true\n   */\n  cycleHandling?: boolean;\n\n  /**\n   * The maximum depth that must be traversed.\n   *\n   * Root object has depth 0.\n   *\n   * Default: Number.Infinity\n   */\n  maxDepth?: number;\n\n  /**\n   * If true, traversal will stop as soon as the callback returns a truthy value.\n   *\n   * This is useful for search use cases, where you typically want to skip traversing the remaining nodes once the target is found.\n   *\n   * Default: false\n   */\n  haltOnTruthy?: boolean;\n\n  /**\n   * The string to be used as separator for the `meta.nodePath` segments.\n   *\n   * Set to null if you wish to turn off `meta.nodePath` to increase traversal speed.\n   *\n   * Default: '.'\n   */\n  pathSeparator?: string | null;\n};\n```\n\n## Examples\n\n### Double all numbers in-place\n\n<details>\n  <summary>Click to expand</summary>\n\n```javascript\nexampleObject = {\n  name: 'Hello World!',\n  age: 1,\n  accounts: 2,\n  friends: 3,\n};\n```\n\n</details>\n\n```javascript\nfunction double({ parent, key, value, meta }) {\n  if (typeof value === 'number') {\n    parent[key] = value * 2;\n  }\n}\n\ntraverse(exampleObject, double);\n\nconsole.log(exampleObject);\n// {\n//   name: 'Hello World!',\n//   age: 2,\n//   accounts: { checking: 4, savings: 6 },\n//   friends: 8\n// }\n```\n\n### Find deep nested values by criteria\n\n<details>\n  <summary>Click to expand</summary>\n\n```javascript\nnetwork = {\n  name: 'Person1',\n  age: 52,\n  friends: [\n    {\n      name: 'Person2',\n      age: 25,\n      friends: [],\n    },\n    {\n      name: 'Person3',\n      age: 42,\n      friends: [\n        {\n          name: 'Person4',\n          age: 18,\n          friends: [\n            {\n              name: 'Person5',\n              age: 33,\n              friends: [],\n            },\n          ],\n        },\n      ],\n    },\n  ],\n};\n```\n\n</details>\n\n```javascript\nconst numbersOver25 = [];\n\nfunction collectOver25({ parent, key, value, meta }) {\n  if (key === 'age' && value > 25) {\n    numbersOver25.push(value);\n  }\n}\n\ntraverse(network, collectOver25);\n\nconsole.log(numbersOver25);\n// [ 52, 42, 33 ]\n```\n\n### Find paths by criteria\n\n<details>\n  <summary>Click to expand</summary>\n\n```javascript\nnetwork = {\n  name: 'Alice Doe',\n  age: 52,\n  friends: [\n    {\n      name: 'John Doe',\n      age: 25,\n      friends: [],\n    },\n    {\n      name: 'Bob Doe',\n      age: 42,\n      friends: [\n        {\n          name: 'John Smith',\n          age: 18,\n          friends: [\n            {\n              name: 'Charlie Doe',\n              age: 33,\n              friends: [],\n            },\n          ],\n        },\n      ],\n    },\n  ],\n};\n```\n\n</details>\n\n```javascript\nconst pathsToPeopleNamedJohn = [];\n\nfunction callback({ parent, key, value, meta }) {\n  if (value.name && value.name.startsWith('John')) {\n    pathsToPeopleNamedJohn.push(meta.nodePath);\n  }\n}\n\ntraverse(network, callback);\n\nconsole.log(pathsToPeopleNamedJohn);\n// [ 'friends.0', 'friends.1.friends.0' ]\n```\n\n### Get node by path\n\n<details>\n  <summary>Click to expand</summary>\n\n```javascript\nnetwork = {\n  name: 'Alice Doe',\n  age: 52,\n  friends: [\n    {\n      name: 'John Doe',\n      age: 25,\n      friends: [],\n    },\n    {\n      name: 'Bob Doe',\n      age: 42,\n      friends: [\n        {\n          name: 'John Smith',\n          age: 18,\n          friends: [\n            {\n              name: 'Charlie Doe',\n              age: 33,\n              friends: [],\n            },\n          ],\n        },\n      ],\n    },\n  ],\n};\n```\n\n</details>\n\n```javascript\nimport { getNodeByPath } from 'object-traversal';\n\nconst firstFriend = getNodeByPath(network, 'friends.0');\nconsole.log(firstFriend);\n// { name: 'John Doe', age: 25, friends: [] }\n```\n\n### Breadth-first traversal\n\n<details>\n  <summary>Click to expand</summary>\n\n```javascript\nnetwork = {\n  name: 'Person 1',\n  age: 52,\n  friends: [\n    {\n      name: 'Person 2',\n      age: 42,\n      friends: [\n        {\n          name: 'Person 4',\n          age: 18,\n          friends: [],\n        },\n      ],\n    },\n    {\n      name: 'Person 3',\n      age: 25,\n      friends: [],\n    },\n  ],\n};\n```\n\n</details>\n\n```javascript\nlet names = [];\n\nfunction getName({ parent, key, value, meta }) {\n  if (value.name) {\n    names.push(value.name);\n  }\n}\n\ntraverse(network, getName, { traversalType: 'breadth-first' });\n\nconsole.log(names);\n// [ 'Person 1', 'Person 2', 'Person 3', 'Person 4' ]\n```\n\n## Roadmap\n\n- [x] Configurable BFS/DFS\n- [x] Max depth\n- [x] Configurable path separator\n- [x] Utility for consuming paths\n- [x] Toggleable cycle handler\n- [ ] Iterator support\n- [ ] Sequential promise support\n- [ ] Multi threading & further speed enhancements\n- [ ] Streaming research\n- [ ] More granular cycleHandling: 'revisit', 'norevisit', and 'off'\n\n## Built with\n\n[TSDX](https://github.com/formium/tsdx)<br>\n[np](https://github.com/sindresorhus/np)<br>\n[yarn 1.22.10](https://yarnpkg.com/)\n","readmeFilename":"README.md","repository":{"type":"git","url":"https://github.com/DevimalPlanet/object-traversal.git"},"keywords":["traverse","object","traversal","recurse","recursive","recursion","js","javascript","graph","tree","walk","walker","iterator","json","deep"]}