Security News
Opengrep Emerges as Open Source Alternative Amid Semgrep Licensing Controversy
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Emit error if callback is executed with a truthy 1st argument
var EventEmitter = require('events').EventEmitter,
emitError = require('emit-error')
var emitter = new EventEmitter().on('error', function (err) {
console.error(err)
})
function fail (cb) {
cb(new Error('failed'))
}
function succeed (cb) {
cb(null, 'success')
}
fail(emitError(emitter, function (status) {
console.log('will not see this')
}))
fail(emitError(emitter, {alwaysCall: true}, function (err, status) {
// When always call specified, err is passed
console.log('will see this')
}))
succeed(emitError(emitter, function (status) {
// Gets called with status of success
console.log(status)
}))
var emitError = require('emit-error')
Returns a function that when called with a truthy first argument, will emit that value
as an error
event on the supplied event emitter
. If the option alwaysCall
is defined,
the provided cb
will be executed in all cases with all arguments supplied to wrappedCb
, otherwise
if the 1st argument to wrappedCb
is falsey, the supplied cb
will be executed with all but the
1st argument supplied to wrappedCb
.
If no callback cb
is provided, then the generated callback will simply emit error events when
called with a non-falsey 1st argument.
options:
true
or false
- if true, the provided callback cb
will always be called (and include
the 1st argument), otherwise it will only be called when a the first argument is falsey (and without the
1st argument)npm test [--dot | --spec] [--coverage]
--dot
- output test results as dots instead of tap--spec
- output test results as spec instead of tap--coverage
- display text cover report--testling
- run tests in browser via testling (cannot be used with --coverage and
expects both browserify and testling to be installed globally)Only run test files matching a certain pattern by prefixing the
test command with grep=pattern
. Example:
grep=connect npm test --dot
Open it with npm run view-cover
or npm run vc
FAQs
Emit error if callback is executed with a non-null 1st argument
The npm package emit-error receives a total of 5 weekly downloads. As such, emit-error popularity was classified as not popular.
We found that emit-error 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
Opengrep forks Semgrep to preserve open source SAST in response to controversial licensing changes.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.