
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
a more powerful option parser for node.js
If you're looking for documentation, please refer to the wiki.
Because I'm tired of using option parsers that don't do their jobs very well. Nearly every parser I've used has required either a workaround to actually make it work, or boilerplate code that's off-putting (at least, for some developers). In short: untraditional implementations and poor abstractions.
Take optimist and yargs, for example: both of them are great parsers in their own right, but they provide no method or abstraction for handling arguments in the order in which they appear on the command-line.
Instead, the way I've seen most people use both of these excellent parsers inherently makes their programs handle args in the order in which they are handled:
#!/usr/bin/env node
// ex.js
// an example of optimist in action
var args = require('optimist')
.usage('Do stuff')
.describe('h', 'print this message and exit')
.describe('v', 'print program version and exit')
.argv;
if (args.v)
console.log('1.0');
process.exit(0);
if (args.h)
args.showHelp();
process.exit(0);
Because -v is handled before -h; so even if you run node ex.js -h -v, the version string will always get printed instead of the expected usage information.
In optimist, the problem can sort of be resolved by looping over the resulting args object using Object.key like so:
#!/usr/bin/env node
// ex.js
// an example of optimist in action
var args = require('optimist')
.usage('Do stuff')
.describe('h', 'print this message and exit')
.describe('v', 'print program version and exit')
.argv;
// doesn't capture commands
// can also be done in a really ugly way like so:
// Object.keys(args).slice(Object.keys(args).indexOf('$0') + 1)
Object.keys(args).slice(2).forEach(function(key) {
/* process args using a switch */
});
I say sort of because the above solution doesn't capture commands, is ugly, and doesn't work with yargs!!
FAQs
a more powerful, option parser for node.js
We found that bebopt 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.