Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cli-argument-parser

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cli-argument-parser - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

0

lib/index.d.ts

@@ -0,0 +0,0 @@ /**

18

lib/index.js

@@ -24,7 +24,7 @@ "use strict";

const finalArgumentsList = {};
const argumentsList = process.argv.filter((argument) => argument.startsWith(prefix) && argument.indexOf(seperator) !== -1);
const argumentsList = filterer(prefix, seperator);
for (const argument of argumentsList) {
const splitArgument = argument.split(seperator);
const splitArgument = (seperator !== '') ? argument.split(seperator) : [argument, undefined];
const name = splitArgument[0].replace(prefix, '');
const value = splitArgument[1];
const value = (splitArgument[1] !== undefined) ? splitArgument[1] : '';
finalArgumentsList[name] = value;

@@ -35,1 +35,13 @@ }

exports.filterArguments = filterArguments;
/**
* A filter function to filter by dynamic prefix & seperator
* @param prefix The prefix of the argument
* @param seperator The seperator of the argument
*/
function filterer(prefix, seperator) {
if (prefix !== '' && seperator === '')
return process.argv.filter((argument) => argument.startsWith(prefix));
else if (prefix === '' && seperator !== '')
return process.argv.filter((argument) => argument.indexOf(seperator) !== -1);
return process.argv;
}

11

package.json
{
"name": "cli-argument-parser",
"version": "0.0.8",
"version": "0.0.9",
"description": "A package containing relevant CLI actions",

@@ -13,3 +13,3 @@ "main": "lib/index.js",

"pre-deploy": "npm run unit-tests && npm run configuration-unit-tests && npm run build",
"deploy": "npm version patch && npm publish"
"deploy": "npm-deploy cli-argument-parser"
},

@@ -31,7 +31,8 @@ "repository": {

"@types/chai": "^4.2.11",
"@types/file-exists": "4.0.0",
"@types/mocha": "^7.0.2",
"@types/node": "14.0.5",
"chai": "^4.2.0",
"mocha": "^8.0.1",
"chai": "^4.2.0",
"@types/file-exists": "4.0.0",
"@types/node": "14.0.5",
"npm-package-deployer": "0.0.6",
"ts-jest": "^26.0.0",

@@ -38,0 +39,0 @@ "ts-node": "^8.10.2",

@@ -0,0 +0,0 @@ # Command-line Argument Parser · [![GitHub license](https://img.shields.io/badge/license-BSD%203%20Clause-blue.svg)](https://github.com/danitseitlin/cli-argument-parser/blob/master/LICENSE) [![npm version](http://img.shields.io/npm/v/cli-argument-parser.svg?style=flat)](https://npmjs.org/package/cli-argument-parser "View this project on npm") ![CI](https://github.com/danitseitlin/cli-argument-parser/workflows/CI/badge.svg)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc