
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@mybug/awaitor
Advanced tools
awaitable callback.
async/await way to call callback style functions
Ownership of this package has been transferred, please use [@superjs/awaitor](https://www.npmjs .com/package/@superjs/awaitor)
If you want to convert callback style to async/await style, you can either:
awaitor()
return an awaitable callback, the promiseValue of which is the args array it's called with
awaitor.norm()
same as above, but it only accept two args: (err,value)
. If err exists, promiseValue will be err
and rejected.
Otherwise, promiseValue will be value
.
const awaitor = require('@mybug/awaitor')
// await can't be used without being wrapped by async function
;(async ()=>{
let cb = awaitor()
foo(1,2,cb) // whenever a callback is needed, just use cb
let result = await cb //result is an array, containing the args cb received
console.log(result) // [3]
})()
function foo(a,b,cb){
setTimeout(()=>cb(a+b),1000)
}
wait can await something synchronously.
const awaitor = require('@mybug/awaitor')
const wait = require('@mybug/wait')
let cb = awaitor()
foo(1,2,cb) // whenever a callback is needed, just use cb
let result = wait(cb) //result is an array, containing the args cb received
console.log(result) // [3]
function foo(a,b,cb){
setTimeout(()=>cb(a+b),1000)
}
You can use @mybug/awaitor in both nodejs and browser environment.
FAQs
awaitable callback
The npm package @mybug/awaitor receives a total of 0 weekly downloads. As such, @mybug/awaitor popularity was classified as not popular.
We found that @mybug/awaitor 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.