
Security News
Open Source Maintainers Feeling the Weight of the EU’s Cyber Resilience Act
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
array-asyncify
Advanced tools
We cannot use async function graceful in array methods such as filter
,map
,reduce
and so on.
So the following code do not work
let a=[1,2,3]
a.map(async (e)=>{
//some async operations
//await ...
return e+1
})
.filter(async (e)=>{
//some async operations
return e%2===0
})
const { asyncify } = require("array-asyncify")
let delay = (t) => new Promise(res => setTimeout(res,t))
console.log("Example:");
(async () => {
let a = asyncify([1, 2, 3])
console.log("ret:")
let ret = await a
.map(async (e) => {
await delay(100);
return e + 1
})
.map(async (e) => {
await delay(100)
return e * 2
})
console.log(ret)
try {
let b = asyncify([1, Promise.resolve(2), 3])
console.log("sum:", await b.reduce(async (p, n) => {
console.log("p,n", p, n)
return p + n
}))
} catch (e) {
console.log(e)
}
})()
asyncify other method.
FAQs
Async array functions
The npm package array-asyncify receives a total of 32 weekly downloads. As such, array-asyncify popularity was classified as not popular.
We found that array-asyncify 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
The EU Cyber Resilience Act is prompting compliance requests that open source maintainers may not be obligated or equipped to handle.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.