Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Execute an error-first callback upon resolution or rejection of a promise (and return the promise)
Execute an error-first callback upon resolution or rejection of a promise, and return the promise.
This makes it easier to write functions that support both callback and promise based async patterns.
var afterward = require('afterward'),
Promise = require('promise-polyfill')
function greet (name, cb) {
var prom = new Promise(function (resolve) {
setTimeout(resolve.bind(undefined, 'greetings ' + name), 100)
})
return afterward(prom, cb)
}
// we can now use our fancy function either way...
// with a callback:
greet('jason', function (err, msg) {
if (err) return console.error(err)
console.log(msg)
})
// or a promise
greet('gege').then(console.log).catch(console.error)
var afterward = require('afterward')
Upon resolution or rejection of the promise prom
, execute the optional error-first style callback cb
. The promise prom
is returned.
var UnknownError = require('afterward/errors').UnknownError
The constructor function of the Error
object provided to callback cb
when the Promise prom
is rejected with no argument.
npm test [--dot | --spec] [--phantom] [--grep=pattern]
Specifying --dot
or --spec
will change the output from the default TAP style.
Specifying --phantom
will cause the tests to run in the headless phantom browser instead of node.
Specifying --grep
will only run the test files that match the given pattern.
npm run browser-test
This will run the tests in all browsers (specified in .zuul.yml). Be sure to educate zuul first.
npm run coverage [--html]
This will output a textual coverage report. Including --html
will also open
an HTML coverage report in the default browser.
FAQs
Execute an error-first callback upon resolution or rejection of a promise (and return the promise)
The npm package afterward receives a total of 3,016 weekly downloads. As such, afterward popularity was classified as popular.
We found that afterward 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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.