
Research
/Security News
Malicious npm Packages Target WhatsApp Developers with Remote Kill Switch
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
async-traverse-tree
Advanced tools
async-traverse-tree
is a lightweight, asynchronous library for traversing and mapping tree-like data structures.
You can install async-traverse-tree
using npm or yarn:
npm install async-traverse-tree
or
yarn add async-traverse-tree
Here's a simple example of how to use async-traverse-tree
with the updated implementation:
// Import the 'traverse' function from 'async-traverse-tree'
import { traverse } from 'async-traverse-tree';
// Define a custom mapper function
const mapper = async (key, value) => {
// Apply your custom logic here asynchronously
return value;
};
// Your data structure
const data = /* Your data structure here */;
// Asynchronously traverse and map the data
traverse(data, mapper)
.then(result => {
// Process the result
console.log(result);
})
.catch(error => {
console.error(error);
});
The async-traverse-tree module exports two symbols that can be used to control the traversal process:
import { traverse, STOP, REMOVE } from 'async-traverse-tree';
const mapper = async (key, value) => {
// stop traversing deeper into this branch
if (skipCondition) {
return STOP
}
// remove this key/value completely
if (removeCondition) {
return REMOVE
}
// Apply your custom logic here asynchronously
return value;
};
An easy way to iterate over an object-like structure is to use JSON.parse(JSON.stringify(obj), (key, value) => ... )
.
The 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.
FAQs
Asynchronously iterates and transforms tree-like structures.
The npm package async-traverse-tree receives a total of 7,383 weekly downloads. As such, async-traverse-tree popularity was classified as popular.
We found that async-traverse-tree demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.