Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
sync-async-loops
Advanced tools
a tool to help you controll asynchronous loops, speed things up, and make sure certain parts are executed in an orderly fashion while keeping the asynchronous nature of the loop
The library purpose is to help you synchronise asynchronous loops in order to obtain a better performance
const Synchronizer = require ('sync-async-loops')
const synchronizer = new Synchronizer() if you want to use your own Promise.all(data.map())
await new Synchronizer(data, (synchronizer, item, index, .....) => {})
Create a point from which the loops will be executed one by one,starting with the first index
It behaves as if the loop just started.
Calls an async function using the provided params, and for each call, it returns the same promise, making sure to make only one call for all the items that are being processed
unlike sync, this one waits for all the loops to reach this point before letting them go
if we use Synchronizer(data, () => {}) instead of Promise.all(data.map()) then we can ommit the length paramter
await Promise.all(
data.map(async (item, index) => {
resultsArrOne.push(item)
await synchronizer.runOnce(sleepRandom, 'sleep', 'param1', 'param2')
await synchronizer.sync(index)
resultsArrTwo.push(item)
})
)
const findProjectsByUserNames = async (userNames) => {
const users = await usersRepositoy.findUsersByName(userNames)
const userIds= []
const projects = []
await new Synchronizer( users, async (user, index) => {
userIds.push(user.id)
await synchronizer.waitAll(index)
const userProjects = await synchronizer.runOnce(findProjectsByUserIds, 'getProjectUsers', userIds)
const projectsMap = synchronizer.runOnce(mapProjects, 'mapProjectUsers', userProjects)
const project = projectsMap.get(userId)
projects.push({
...project,
userFullName: `${user.firstName} ${user.lastName}`
})
})
return projects
}
const mapProjects (userProjects) => {
const projectsMap = new Map()
for (project of Projects){
projectsMap.set(project.user.id, project)
}
return projectsMap
}
FAQs
a tool to help you controll asynchronous loops, speed things up, and make sure certain parts are executed in an orderly fashion while keeping the asynchronous nature of the loop
The npm package sync-async-loops receives a total of 0 weekly downloads. As such, sync-async-loops popularity was classified as not popular.
We found that sync-async-loops 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.