
Security News
Deno 2.6 + Socket: Supply Chain Defense In Your CLI
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.
deep-iterate
Advanced tools
Iterate through multidimensional arrays and arrays nested in objects e.g. "days.data.jobs[0]".
Iterate through multidimensional arrays and arrays nested in objects e.g. "days.workLog.jobs" where days and jobs are arrays and workLog is a nested object.
Iterating over a multidimensional array can be slow and will block your application from doing any other processing whilst it's running. Please use sparingly.
Here's a simple example to get you started:
const deepIterate = require(`deep-iterate`);
const jobsPerDay = [{
dayName: `Monday`,
someObject: {
someProp: `abc`,
jobs: [87392, 12348, 47209, 94872],
},
}, {
dayName: `Tuesday`,
someObject: {
someProp: `def`,
jobs: [26348, 59272, 69390],
},
}, {
dayName: `Wednesday`,
someObject: {
someProp: `ghi`,
jobs: [18340],
},
}];
// Iterate over the given path, passing the values from the arrays "jobsPerDay" and "jobs" to the iteratee.
deepIterate(jobsPerDay, `jobsPerDay.someObject.jobs`, (day, job) => {
console.log(`${day.dayName}: ${job}`);
});
// Iterate over the given path, passing the values from every level to the iteratee.
deepIterate.withAllLevels(jobsPerDay, `jobsPerDay.someObject.jobs`, (day, someObject, job) => {
console.log(`${day.dayName}: (${someObject.someProp}) ${job}`);
});
A few things to take note of:
path must include the name of the variable, for example if you have an array called days the first part of the path must be days..array1.someObject.anotherObject.array2.array1.array2, the iteratee will be called for every element in array2..forEach() on your array.Iterate over a multidimensional array, passing only the values from the arrays to the iteratee. See the quick start example above or run the example with node ./examples/basicExample.js.
Iteratee Signature: iteratee(array1, array2, ...arrayN)
Iterate over a multidimensional array, passing the values from all levels to the iteratee. See the quick start example above or run the example with node ./examples/basicExample.js.
Iteratee Signature: iteratee(level1, level2, ...levelN)
FAQs
Iterate through multidimensional arrays and arrays nested in objects e.g. "days.data.jobs[0]".
The npm package deep-iterate receives a total of 0 weekly downloads. As such, deep-iterate popularity was classified as not popular.
We found that deep-iterate demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.

Security News
New DoS and source code exposure bugs in React Server Components and Next.js: what’s affected and how to update safely.

Security News
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.