Socket
Socket
Sign inDemoInstall

yargs-parser

Package Overview
Dependencies
0
Maintainers
3
Versions
83
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 20.2.9 to 21.0.0

7

build/lib/index.js

@@ -10,6 +10,6 @@ /**

import { format } from 'util';
import { readFileSync } from 'fs';
import { normalize, resolve } from 'path';
import { camelCase, decamelize, looksLikeNumber } from './string-utils.js';
import { YargsParser } from './yargs-parser.js';
import { readFileSync } from 'fs';
// See https://github.com/yargs/yargs-parser#supported-nodejs-versions for our

@@ -19,3 +19,3 @@ // version support policy. The YARGS_MIN_NODE_VERSION is used for testing only.

? Number(process.env.YARGS_MIN_NODE_VERSION)
: 10;
: 12;
if (process && process.version) {

@@ -44,3 +44,4 @@ const major = Number(process.version.match(/v([^.]+)/)[1]);

else if (path.match(/\.json$/)) {
return readFileSync(path, 'utf8');
// Addresses: https://github.com/yargs/yargs/issues/2040
return JSON.parse(readFileSync(path, 'utf8'));
}

@@ -47,0 +48,0 @@ else {

@@ -36,2 +36,5 @@ /**

const args = tokenizeArgString(argsInput);
// tokenizeArgString adds extra quotes to args if argsInput is a string
// only strip those extra quotes in processValue if argsInput is a string
const inputIsString = typeof argsInput === 'string';
// aliases might have transitive relationships, normalize this.

@@ -204,3 +207,3 @@ const aliases = combineAliases(Object.assign(Object.create(null), opts.alias));

else {
setArg(m[1], m[2]);
setArg(m[1], m[2], true);
}

@@ -479,3 +482,3 @@ }

if (!isUndefined(argAfterEqualSign)) {
argsToSet.push(processValue(key, argAfterEqualSign));
argsToSet.push(processValue(key, argAfterEqualSign, true));
}

@@ -490,3 +493,3 @@ for (let ii = i + 1; ii < args.length; ii++) {

i = ii;
argsToSet.push(processValue(key, next));
argsToSet.push(processValue(key, next, inputIsString));
}

@@ -504,3 +507,3 @@ }

}
function setArg(key, val) {
function setArg(key, val, shouldStripQuotes = inputIsString) {
if (/-/.test(key) && configuration['camel-case-expansion']) {

@@ -512,3 +515,3 @@ const alias = key.split('.').map(function (prop) {

}
const value = processValue(key, val);
const value = processValue(key, val, shouldStripQuotes);
const splitKey = key.split('.');

@@ -564,8 +567,6 @@ setKey(argv, splitKey, value);

}
function processValue(key, val) {
function processValue(key, val, shouldStripQuotes) {
// strings may be quoted, clean this up as we assign values.
if (typeof val === 'string' &&
(val[0] === "'" || val[0] === '"') &&
val[val.length - 1] === val[0]) {
val = val.substring(1, val.length - 1);
if (shouldStripQuotes) {
val = stripQuotes(val);
}

@@ -1045,1 +1046,8 @@ // handle parsing boolean arguments --foo=true --bar false.

}
function stripQuotes(val) {
return (typeof val === 'string' &&
(val[0] === "'" || val[0] === '"') &&
val[val.length - 1] === val[0])
? val.substring(1, val.length - 1)
: val;
}

@@ -5,2 +5,19 @@ # Changelog

## [21.0.0](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.9...yargs-parser-v21.0.0) (2021-11-15)
### ⚠ BREAKING CHANGES
* drops support for 10 (#421)
### Bug Fixes
* esm json import ([#416](https://www.github.com/yargs/yargs-parser/issues/416)) ([90f970a](https://www.github.com/yargs/yargs-parser/commit/90f970a6482dd4f5b5eb18d38596dd6f02d73edf))
* parser should preserve inner quotes ([#407](https://www.github.com/yargs/yargs-parser/issues/407)) ([ae11f49](https://www.github.com/yargs/yargs-parser/commit/ae11f496a8318ea8885aa25015d429b33713c314))
### Code Refactoring
* drops support for 10 ([#421](https://www.github.com/yargs/yargs-parser/issues/421)) ([3aaf878](https://www.github.com/yargs/yargs-parser/commit/3aaf8784f5c7f2aec6108c1c6a55537fa7e3b5c1))
### [20.2.9](https://www.github.com/yargs/yargs-parser/compare/yargs-parser-v20.2.8...yargs-parser-v20.2.9) (2021-06-20)

@@ -7,0 +24,0 @@

{
"name": "yargs-parser",
"version": "20.2.9",
"version": "21.0.0",
"description": "the mighty option parser used by yargs",

@@ -22,2 +22,3 @@ "main": "build/index.cjs",

"test": "c8 --reporter=text --reporter=html mocha test/*.cjs",
"test:esm": "c8 --reporter=text --reporter=html mocha test/*.mjs",
"test:browser": "start-server-and-test 'serve ./ -p 8080' http://127.0.0.1:8080/package.json 'node ./test/browser/yargs-test.cjs'",

@@ -52,4 +53,4 @@ "pretest:typescript": "npm run pretest",

"@types/chai": "^4.2.11",
"@types/mocha": "^8.0.0",
"@types/node": "^14.0.0",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.4",
"@typescript-eslint/eslint-plugin": "^3.10.1",

@@ -66,7 +67,7 @@ "@typescript-eslint/parser": "^3.10.1",

"mocha": "^9.0.0",
"puppeteer": "^10.0.0",
"puppeteer": "^11.0.0",
"rimraf": "^3.0.2",
"rollup": "^2.22.1",
"rollup-plugin-cleanup": "^3.1.1",
"serve": "^12.0.0",
"serve": "^13.0.0",
"standardx": "^7.0.0",

@@ -83,3 +84,3 @@ "start-server-and-test": "^1.11.2",

"engines": {
"node": ">=10"
"node": ">=12"
},

@@ -86,0 +87,0 @@ "standardx": {

Sorry, the diff of this file is not supported yet

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