You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

dashargs

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dashargs - npm Package Compare versions

Comparing version

to
4.1.2

2

package.json
{
"name": "dashargs",
"version": "4.0.2",
"version": "4.1.2",
"description": "Simple package for parsing command line style arguments",

@@ -5,0 +5,0 @@ "main": "./src/index.cjs",

@@ -128,2 +128,14 @@ # DashArgs

```
```js
// Check if it has any one of the supplied keys
const statement = '-a b -c d';
const parsed = dash.strip(statement, {
removeWhitespace: true,
removeFlags: true,
removeArgs: true
});
console.log(parsed.has('x', 'a')) // true
```
- ## Get

@@ -130,0 +142,0 @@ `dash.parse(string, options).get(key)`

@@ -47,13 +47,15 @@ const Parser = require('./Parser.js');

*/
has(key) {
if (!key)
has(...keys) {
if (!keys)
throw new SyntaxError(
"dashargs#parse(has) - must provide a key: <parsed-args>.has('key')",
"dashargs#parse(has) - must provide a key or keys: <parsed-args>.has('key')",
);
if (typeof key != 'string')
const invalidType = keys.find((k) => typeof k != 'string');
if (invalidType)
throw new TypeError(
'dashargs#parse(has) - given key must be a string',
'dashargs#parse(has) - given key(s) must be a string',
);
return !!this.get(key);
return !!this.#parsed.find(({ key }) => [...keys].includes(key));
}

@@ -60,0 +62,0 @@