
Security News
Socket Releases Free Certified Patches for Critical vm2 Sandbox Escape
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.
Eazy handling of complex promise chains
npm install uzijs
npm install
var Uzi = require('./uzi')
npm test
A promise function passed into Uzi must return a promise with a resolve/reject callback.
var p1 = (param) => {
return new Promise((resolve, reject) => {
resolve("Apple")
})
}
var p2 = (param) => {
return new Promise((resolve, reject) => {
setTimeout(() => resolve("Banana"), 3)
})
}
var p3 = (param) => {
return new Promise((resolve, reject) => {
setTimeout(() => reject("Error"), 10)
})
}
Here is a minimal example where each promise will be fired on after the other
new Uzi([p2, p1]).fire()
You can extend this to have a callback after all the promises are complete.
new Uzi([p2, p1])
.then(() => console.log("cool!"))
.fire()
Here is a feature complete example of what Uzijs can do with this...
var messages = []
new Uzi([p2, p1])
.first(() => messages.push('first')) // perform a function before anything else
.hit(() => messages.push('hit')) // on a resolved promise
.then(() => messages.push('then')) // after all promises have been completed
.fire() // start the promise chain so they are all completed in order
.reload([p2, p1, p3]) // start a new promise chain, pass no arguments to reload the existing promise chain
.first(() => messages.push('reloaded'))
.miss(() => messages.push('miss')) // on a failed promise
.hit(() => messages.push('hit'))
.then(() => {
console.log(messages) // ['first', 'hit', 'hit', 'then', 'reload', 'hit', 'hit', 'miss']
})
.spray() // fire all promises at the same time
FAQs
Eazy handling of complex promise chains
The npm package uzijs receives a total of 0 weekly downloads. As such, uzijs popularity was classified as not popular.
We found that uzijs 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
A critical vm2 sandbox escape can allow untrusted JavaScript to break isolation and execute commands on the host Node.js process.

Research
Five malicious NuGet packages impersonate Chinese .NET libraries to deploy a stealer targeting browser credentials, crypto wallets, SSH keys, and local files.

Security News
pnpm 11 turns on a 1-day Minimum Release Age and blocks exotic subdeps by default, adding safeguards against fast-moving supply chain attacks.