Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Parse command line arguments
If you're looking to use this in a CLI app, you probably want meow
instead.
$ npm install argvments
$ ./unicorn.js foobar --rainbow
const argvments = require('argvments');
argvments(process.argv.slice(2));
/*
{
input: ['foobar'],
flags: {
rainbow: true
}
}
*/
Type: Array
Arguments to parse.
Type: Object
Same as minimist
. Keys passed to the default
option are decamelized, so you can for example pass in fooBar: 'baz'
and have it be the default for the --foo-bar
flag.
Type: Array
In addition to the types supplied by minimist
(boolean
and string
) you can also choose to treat your arguments as any
. This will treat --rainbow
as true
and --rainbow=foo
as foo
.
const argvments = require('argvments');
const argv = argvments(process.argv.slice(2), {any: ['rainbow']});
console.log(argv.flags.rainbow);
$ ./unicorn.js --rainbow
//=> true
$ ./unicorn.js --rainbow=foo
//=> 'foo'
$ ./unicorn.js --rainbow foo
//=> true
Type: boolean
Default: false
Infer the argument type.
By default, the argument 5
in $ foo 5
becomes a string. Enabling this would infer it as a number.
MIT © Kevin Mårtensson
FAQs
Parse command line arguments
We found that argvments 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’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.