{"_id":"async-traverse-tree","_rev":"5-c43df78434c8c67a3294fd22ab7fb29e","name":"async-traverse-tree","dist-tags":{"latest":"1.1.1"},"versions":{"1.0.0":{"name":"async-traverse-tree","version":"1.0.0","keywords":["traverse","walk","recursive","map","deep"],"author":{"name":"Ben Zörb","email":"ben@sommerlaune.com"},"license":"MIT","_id":"async-traverse-tree@1.0.0","maintainers":[{"name":"bezoerb","email":"ben@sommerlaune.com"}],"dist":{"shasum":"9067bdf5b3f21ceffc0369b28d1c1a27a8797871","tarball":"https://registry.npmjs.org/async-traverse-tree/-/async-traverse-tree-1.0.0.tgz","fileCount":5,"integrity":"sha512-1JA6oDXgnbvbk+5P95uTpVphbvGll+OQB0llQ8amlSDdA52RqIPWcdUPRCiPcKp4tZJFe2gVKEgwyLnertbIQA==","signatures":[{"sig":"MEUCIQD3/mfBI9axPwFebnRY6DuG2BAeGBHtdYpIgoa7mzMZ1AIgb3Hjzt7XjvP/fxj29NaFiHA9bAP8B/sepgTh1YXeFdU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6239},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":"./index.js","gitHead":"26893b2e75710a82538eb574a98a2a4b9ab5c77d","scripts":{"test":"c8 ava"},"_npmUser":{"name":"bezoerb","email":"ben@sommerlaune.com"},"_npmVersion":"9.6.7","description":"Asynchronously iterates and transforms tree-like structures.","directories":{},"_nodeVersion":"18.17.1","_hasShrinkwrap":false,"devDependencies":{"c8":"^8.0.1","ava":"^5.3.1"},"_npmOperationalInternal":{"tmp":"tmp/async-traverse-tree_1.0.0_1697926294661_0.22960340591175932","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"async-traverse-tree","version":"1.0.1","keywords":["traverse","walk","recursive","map","deep"],"author":{"name":"Ben Zörb","email":"ben@sommerlaune.com"},"license":"MIT","_id":"async-traverse-tree@1.0.1","maintainers":[{"name":"bezoerb","email":"ben@sommerlaune.com"}],"homepage":"https://github.com/bezoerb/async-traverse-tree#readme","bugs":{"url":"https://github.com/bezoerb/async-traverse-tree/issues"},"dist":{"shasum":"92f706fcfaeddd051bbff722b256f7cfe0e05680","tarball":"https://registry.npmjs.org/async-traverse-tree/-/async-traverse-tree-1.0.1.tgz","fileCount":5,"integrity":"sha512-QhYIU/rysoEJSLTHte1Zi2JzQl5jtiC/FWKOMUo08yvqNJhp3V20Np3GrSCmUPutyqCcEEy4o2zdcMZaOc3yCQ==","signatures":[{"sig":"MEUCIQCMALIVc/nBNjAWkhvQXRQBD8FwVa/loBtEU464cyYdGAIgUrPUuwjpTO15LxeiTncOu0Vyf84/wfQLM1mRZl7evOk=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":6964},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":"./index.js","gitHead":"a92715c85ecd8bca2d86330bff10e64a1e712c28","scripts":{"test":"c8 ava","test:ci":"npm run test && npm run coverage","coverage":"c8 report --reporter=lcov"},"_npmUser":{"name":"bezoerb","email":"ben@sommerlaune.com"},"repository":{"url":"git+https://github.com/bezoerb/async-traverse-tree.git","type":"git"},"_npmVersion":"8.15.0","description":"Asynchronously iterates and transforms tree-like structures.","directories":{},"_nodeVersion":"16.17.0","_hasShrinkwrap":false,"devDependencies":{"c8":"^8.0.1","ava":"^5.3.1"},"_npmOperationalInternal":{"tmp":"tmp/async-traverse-tree_1.0.1_1698927354406_0.9087467124808182","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"async-traverse-tree","version":"1.0.2","keywords":["traverse","walk","recursive","map","deep"],"author":{"name":"Ben Zörb","email":"ben@sommerlaune.com"},"license":"MIT","_id":"async-traverse-tree@1.0.2","maintainers":[{"name":"bezoerb","email":"ben@sommerlaune.com"}],"homepage":"https://github.com/bezoerb/async-traverse-tree#readme","bugs":{"url":"https://github.com/bezoerb/async-traverse-tree/issues"},"dist":{"shasum":"e5865561b57d16d1330d5225b02f5911768ac5bd","tarball":"https://registry.npmjs.org/async-traverse-tree/-/async-traverse-tree-1.0.2.tgz","fileCount":5,"integrity":"sha512-K2zGn/xo+iNL71dbxlR5b5Qa/rI0AGyEwQejpECrxQJkDW8LUS/Un3vmnmAaODlye4p7o9d0pnIGrVioSMHsmQ==","signatures":[{"sig":"MEUCIHZa1a+b65JWs+eEypTg3GWUkIpGmKo7B/jOEJ5IjuG9AiEAjv9fZFp87+36jxV0Dg7PlKRCDFvGfsXP7bfsZ1FUKC8=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":7018},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":"./index.js","gitHead":"010263f0792ba96aeef2fc35d701a9287e92a630","scripts":{"test":"c8 ava","test:ci":"npm run test && npm run coverage","coverage":"c8 report --reporter=lcov"},"_npmUser":{"name":"bezoerb","email":"ben@sommerlaune.com"},"repository":{"url":"git+https://github.com/bezoerb/async-traverse-tree.git","type":"git"},"_npmVersion":"9.3.1","description":"Asynchronously iterates and transforms tree-like structures.","directories":{},"_nodeVersion":"18.14.0","_hasShrinkwrap":false,"devDependencies":{"c8":"^8.0.1","ava":"^5.3.1"},"_npmOperationalInternal":{"tmp":"tmp/async-traverse-tree_1.0.2_1723588938616_0.13245306648672717","host":"s3://npm-registry-packages"}},"1.1.0":{"name":"async-traverse-tree","version":"1.1.0","keywords":["traverse","walk","recursive","map","deep"],"author":{"name":"Ben Zörb","email":"ben@sommerlaune.com"},"license":"MIT","_id":"async-traverse-tree@1.1.0","maintainers":[{"name":"bezoerb","email":"ben@sommerlaune.com"}],"homepage":"https://github.com/bezoerb/async-traverse-tree#readme","bugs":{"url":"https://github.com/bezoerb/async-traverse-tree/issues"},"dist":{"shasum":"0c5dc8f651d7ffa03719a38e633ce3d4b932b2f7","tarball":"https://registry.npmjs.org/async-traverse-tree/-/async-traverse-tree-1.1.0.tgz","fileCount":5,"integrity":"sha512-T5djGloPIHzq6fyK7FY5x4ei6ovCkIdqHXx6FSAwXby3MXxfHi6BU3EETU/IUYDXcJO4CCmsppZe+nuq9qc/Bw==","signatures":[{"sig":"MEQCIF/VYAH1iTYvr0DOCbvt8jObs8dW1rnXMvOzwoTIWDJlAiAhd6ZYmtFxgZE/MxU4pXwfPQavMdp2up15N8tcsB80QQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":8102},"type":"module","types":"./index.d.ts","engines":{"node":">=16"},"exports":"./index.js","gitHead":"59cc501c8eaf74bcaf1c8ffd0c1ea6554f867bf6","scripts":{"test":"c8 ava","test:ci":"npm run test && npm run coverage","coverage":"c8 report --reporter=lcov"},"_npmUser":{"name":"bezoerb","email":"ben@sommerlaune.com"},"repository":{"url":"git+https://github.com/bezoerb/async-traverse-tree.git","type":"git"},"_npmVersion":"9.3.1","description":"Asynchronously iterates and transforms tree-like structures.","directories":{},"_nodeVersion":"18.14.0","_hasShrinkwrap":false,"devDependencies":{"c8":"^8.0.1","ava":"^5.3.1"},"_npmOperationalInternal":{"tmp":"tmp/async-traverse-tree_1.1.0_1723847383824_0.7397878551097754","host":"s3://npm-registry-packages"}},"1.1.1":{"name":"async-traverse-tree","version":"1.1.1","description":"Asynchronously iterates and transforms tree-like structures.","exports":"./index.js","type":"module","engines":{"node":">=16"},"repository":{"type":"git","url":"git+https://github.com/bezoerb/async-traverse-tree.git"},"scripts":{"test":"c8 ava","coverage":"c8 report --reporter=lcov","test:ci":"npm run test && npm run coverage"},"keywords":["traverse","walk","recursive","map","deep"],"author":{"name":"Ben Zörb","email":"ben@sommerlaune.com"},"devDependencies":{"ava":"^5.3.1","c8":"^8.0.1"},"license":"MIT","gitHead":"dee4a5ff5c30d6f018bf66e4682cbb761f9caf98","types":"./index.d.ts","_id":"async-traverse-tree@1.1.1","bugs":{"url":"https://github.com/bezoerb/async-traverse-tree/issues"},"homepage":"https://github.com/bezoerb/async-traverse-tree#readme","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-AJw7KsD1E58qU5RUJo2hNMNNSedRaR3OXKqZWRdW7iEpaqW5ApWXcDMCDvCMXiCRNBCdoqMvUEV2i/U87rD9fw==","shasum":"1eb61069678e91fe8d6f2ae55213d2a787834bd5","tarball":"https://registry.npmjs.org/async-traverse-tree/-/async-traverse-tree-1.1.1.tgz","fileCount":5,"unpackedSize":8346,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCdR7W/ggUQGq2oW3T0iAxIaQL7DNjgokC4OVRSYfS7cAIgfJ2cahetemVIE9lqJMWyKe+JBHuXHtfKMYLQ0B5/oCE="}]},"_npmUser":{"name":"bezoerb","email":"ben@sommerlaune.com"},"directories":{},"maintainers":[{"name":"bezoerb","email":"ben@sommerlaune.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/async-traverse-tree_1.1.1_1772406922437_0.5842590642581815"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-21T22:11:34.660Z","modified":"2026-03-01T23:15:22.672Z","1.0.0":"2023-10-21T22:11:34.873Z","1.0.1":"2023-11-02T12:15:54.607Z","1.0.2":"2024-08-13T22:42:18.890Z","1.1.0":"2024-08-16T22:29:44.026Z","1.1.1":"2026-03-01T23:15:22.566Z"},"bugs":{"url":"https://github.com/bezoerb/async-traverse-tree/issues"},"author":{"name":"Ben Zörb","email":"ben@sommerlaune.com"},"license":"MIT","homepage":"https://github.com/bezoerb/async-traverse-tree#readme","keywords":["traverse","walk","recursive","map","deep"],"repository":{"type":"git","url":"git+https://github.com/bezoerb/async-traverse-tree.git"},"description":"Asynchronously iterates and transforms tree-like structures.","maintainers":[{"name":"bezoerb","email":"ben@sommerlaune.com"}],"readme":"# async-traverse-tree\n\n[![npm version](https://img.shields.io/npm/v/async-traverse-tree.svg)](https://www.npmjs.com/package/async-traverse-tree)\n[![Build Status](https://github.com/bezoerb/async-traverse-tree/workflows/CI/badge.svg)](https://github.com/bezoerb/async-traverse-tree/actions?workflow=CI)\n[![Coverage Status](https://coveralls.io/repos/github/bezoerb/async-traverse-tree/badge.svg?branch=main)](https://coveralls.io/github/bezoerb/async-traverse-tree?branch=main)\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/bezoerb/async-traverse-tree/blob/main/LICENSE)\n\n`async-traverse-tree` is a lightweight, asynchronous library for traversing and mapping tree-like data structures.\n\n## Features\n\n- Asynchronously traverses and modifies objects and arrays.\n- Easy-to-use API for applying custom functions to each value in the tree.\n- Prevents circular references to maintain data integrity.\n\n## Installation\n\nYou can install `async-traverse-tree` using npm or yarn:\n\n```shell\nnpm install async-traverse-tree\n```\n\nor\n\n```shell\nyarn add async-traverse-tree\n```\n\n## Usage\n\nHere's a simple example of how to use `async-traverse-tree` with the updated implementation:\n\n```javascript\n// Import the 'traverse' function from 'async-traverse-tree'\nimport { traverse } from 'async-traverse-tree';\n\n// Define a custom mapper function\nconst mapper = async (key, value) => {\n  // Apply your custom logic here asynchronously\n  return value;\n};\n\n// Your data structure\nconst data = /* Your data structure here */;\n\n// Asynchronously traverse and map the data\ntraverse(data, mapper)\n  .then(result => {\n    // Process the result\n    console.log(result);\n  })\n  .catch(error => {\n    console.error(error);\n  });\n```\n\n### Controlling Tree Traversal\n\nThe async-traverse-tree module exports two symbols that can be used to control the traversal process:\n\n* **STOP**: Returning STOP from your mapper function will halt traversal of the current branch. No child nodes will be processed.\n* **REMOVE**: Returning REMOVE from your mapper function will remove the current key/value pair from the tree.\n\n\n```javascript\nimport { traverse, STOP, REMOVE } from 'async-traverse-tree';\n\nconst mapper = async (key, value) => {\n\n  // stop traversing deeper into this branch\n  if (skipCondition) {\n    return STOP\n  }\n\n  // remove this key/value completely\n    if (removeCondition) {\n    return REMOVE\n  }\n\n  // Apply your custom logic here asynchronously\n  return value;\n};\n```\n\n## Motivation\n\nAn easy way to iterate over an object-like structure is to use `JSON.parse(JSON.stringify(obj), (key, value) => ... )`.\\\nThe problem with this approach is that it can't handle circular references and is synchronous. `async-traverse-tree` can act like an async drop-in replacement for that which can also handle circular references.\n","readmeFilename":"README.md"}