Socket
Socket
Sign inDemoInstall

yargs-unparser

Package Overview
Dependencies
29
Maintainers
22
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.6.0 to 1.6.1

7

CHANGELOG.md

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

### [1.6.1](https://www.github.com/yargs/yargs-unparser/compare/v1.6.0...v1.6.1) (2020-06-17)
### Bug Fixes
* **deps:** downgrade yargs, such that we continue supporting Node 6 ([#57](https://www.github.com/yargs/yargs-unparser/issues/57)) ([f69406c](https://www.github.com/yargs/yargs-unparser/commit/f69406c34bead63011590f7b51a24a6f311c1a48))
## 1.6.0 (2019-07-30)

@@ -7,0 +14,0 @@

44

index.js

@@ -5,6 +5,9 @@ 'use strict';

const flatten = require('flat');
const { castArray, some, isPlainObject, camelCase, kebabCase, omitBy } = require('lodash');
const camelcase = require('camelcase');
const decamelize = require('decamelize');
const isPlainObj = require('is-plain-obj');
function isAlias(key, alias) {
return some(alias, (aliases) => castArray(aliases).indexOf(key) !== -1);
// TODO Switch to Object.values one Node.js 6 is dropped
return Object.keys(alias).some((id) => [].concat(alias[id]).indexOf(key) !== -1);
}

@@ -17,4 +20,4 @@

function isCamelCased(key, argv) {
return /[A-Z]/.test(key) && camelCase(key) === key && // Is it camel case?
argv[kebabCase(key)] != null; // Is the standard version defined?
return /[A-Z]/.test(key) && camelcase(key) === key && // Is it camel case?
argv[decamelize(key, '-')] != null; // Is the standard version defined?
}

@@ -35,3 +38,3 @@

value.forEach((item) => unparseOption(key, item, unparsed));
} else if (isPlainObject(value)) {
} else if (isPlainObj(value)) {
const flattened = flatten(value, { safe: true });

@@ -84,16 +87,21 @@

function unparseOptions(argv, options, knownPositional, unparsed) {
const optionsArgv = omitBy(argv, (value, key) =>
// Remove positional arguments
knownPositional.includes(key) ||
// Remove special _, -- and $0
['_', '--', '$0'].includes(key) ||
// Remove aliases
isAlias(key, options.alias) ||
// Remove default values
hasDefaultValue(key, value, options.default) ||
// Remove camel-cased
isCamelCased(key, argv));
for (const key of Object.keys(argv)) {
const value = argv[key];
for (const key in optionsArgv) {
unparseOption(key, optionsArgv[key], unparsed);
if (
// Remove positional arguments
knownPositional.includes(key) ||
// Remove special _, -- and $0
['_', '--', '$0'].includes(key) ||
// Remove aliases
isAlias(key, options.alias) ||
// Remove default values
hasDefaultValue(key, value, options.default) ||
// Remove camel-cased
isCamelCased(key, argv)
) {
continue;
}
unparseOption(key, argv[key], unparsed);
}

@@ -100,0 +108,0 @@ }

{
"name": "yargs-unparser",
"description": "Converts back a yargs argv object to its original array form",
"version": "1.6.0",
"version": "1.6.1",
"keywords": [

@@ -17,6 +17,3 @@ "yargs",

"homepage": "https://github.com/yargs/yargs-unparser",
"repository": {
"type": "git",
"url": "git@github.com:yargs/yargs-unparser.git"
},
"repository": "yargs/yargs-unparser",
"license": "MIT",

@@ -29,11 +26,4 @@ "main": "index.js",

"prerelease": "npm t && npm run lint",
"release": "standard-version",
"precommit": "lint-staged",
"commitmsg": "commitlint -e $GIT_PARAMS"
"precommit": "lint-staged"
},
"standard-version": {
"scripts": {
"posttag": "git push --follow-tags origin master"
}
},
"lint-staged": {

@@ -45,24 +35,18 @@ "*.js": [

},
"commitlint": {
"extends": [
"@commitlint/config-conventional"
]
},
"devDependencies": {
"@commitlint/cli": "^8.1.0",
"@commitlint/config-conventional": "^8.1.0",
"eslint": "^6.1.0",
"eslint-config-moxy": "^7.1.0",
"husky": "^3.0.1",
"jest": "^24.8.0",
"lint-staged": "^9.2.1",
"minimist": "^1.2.0",
"standard-version": "^7.0.0",
"yargs-parser": "^13.1.1"
"jest": "^24.9.0",
"lint-staged": "^9.5.0",
"minimist": "^1.2.5",
"yargs-parser": "^18.1.3"
},
"dependencies": {
"camelcase": "^5.3.1",
"decamelize": "^1.2.0",
"flat": "^4.1.0",
"lodash": "^4.17.15",
"yargs": "^13.3.0"
"is-plain-obj": "^1.1.0",
"yargs": "^14.2.3"
}
}
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