Socket
Socket
Sign inDemoInstall

cli-argv-util

Package Overview
Dependencies
1
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.3 to 1.2.4

3

dist/cli-argv-util.d.ts

@@ -1,2 +0,2 @@

//! cli-argv-util v1.2.3 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License
//! cli-argv-util v1.2.4 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License

@@ -23,3 +23,4 @@ export type StringFlagMap = {

readFolder(folder: string): string[];
unquoteArgs(args: string[]): string[];
};
export { cliArgvUtil };

@@ -1,2 +0,2 @@

//! cli-argv-util v1.2.3 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License
//! cli-argv-util v1.2.4 ~~ https://github.com/center-key/cli-argv-util ~~ MIT License

@@ -11,13 +11,3 @@ import { execSync } from 'node:child_process';

const toPair = (flag) => flag.replace(/^--/, '').split('=');
const unquote = (builder, nextArg) => {
const arg = nextArg.replace(/^'/, '').replace(/'$/, '');
const last = builder[1].length - 1;
if (builder[0])
builder[1][last] = builder[1][last] + ' ' + arg;
else
builder[1].push(arg);
const quoteMode = (/^'/.test(nextArg) || builder[0]) && !/'$/.test(nextArg);
return [quoteMode, builder[1]];
};
const args = process.argv.slice(2).reduce(unquote, [false, []])[1];
const args = cliArgvUtil.unquoteArgs(process.argv.slice(2));
const pairs = args.filter(arg => /^--/.test(arg)).map(toPair);

@@ -46,3 +36,16 @@ const flagMap = Object.fromEntries(pairs.map(toEntry));

},
unquoteArgs(args) {
const unquote = (builder, nextArg) => {
const arg = nextArg.replace(/^'/, '').replace(/'$/, '');
const last = builder[1].length - 1;
if (builder[0])
builder[1][last] = builder[1][last] + ' ' + arg;
else
builder[1].push(arg);
const quoteMode = (/^'/.test(nextArg) || builder[0]) && !/'$/.test(nextArg);
return [quoteMode, builder[1]];
};
return args.reduce(unquote, [false, []])[1];
},
};
export { cliArgvUtil };
{
"name": "cli-argv-util",
"version": "1.2.3",
"version": "1.2.4",
"description": "Simple utility to parse command line parameters and flags (arguments vector)",

@@ -19,3 +19,6 @@ "license": "MIT",

},
"repository": "github:center-key/cli-argv-util",
"repository": {
"type": "git",
"url": "git+https://github.com/center-key/cli-argv-util.git"
},
"homepage": "https://github.com/center-key/cli-argv-util",

@@ -22,0 +25,0 @@ "bugs": "https://github.com/center-key/cli-argv-util/issues",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc