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

yargs

Package Overview
Dependencies
Maintainers
3
Versions
250
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yargs - npm Package Compare versions

Comparing version 3.5.4 to 3.6.0

CHANGELOG.md

4

index.js

@@ -129,2 +129,6 @@ var assert = require('assert'),

else {
if (typeof value === 'function') {
defaultDescription = usage.functionDescription(value, defaultDescription);
value = value.call();
}
options.defaultDescription[key] = defaultDescription;

@@ -131,0 +135,0 @@ options.default[key] = value;

12

lib/parser.js

@@ -7,2 +7,6 @@ // fancy-pants parsing of argv, originally forked

function increment (orig) {
return orig !== undefined ? orig + 1 : 0;
}
module.exports = function (args, opts) {

@@ -229,3 +233,3 @@ if (!opts) opts = {};

if (checkAllAliases(key, flags.counts)) {
value = function(orig) { return orig !== undefined ? orig + 1 : 0; };
value = increment;
}

@@ -281,3 +285,3 @@

try {
var config = JSON.parse(fs.readFileSync(configPath, 'utf8'));
var config = require(path.resolve(process.cwd(), configPath));
Object.keys(config).forEach(function (key) {

@@ -328,4 +332,4 @@ // setting arguments via CLI takes precedence over

var key = keys[keys.length - 1];
if (typeof value === 'function') {
o[key] = value(o[key]);
if (value === increment) {
o[key] = increment(o[key]);
}

@@ -332,0 +336,0 @@ else if (o[key] === undefined && checkAllAliases(key, flags.arrays)) {

@@ -214,2 +214,10 @@ // this file handles outputting usage instructions,

self.functionDescription = function (fn, defaultDescription) {
if (defaultDescription) {
return defaultDescription;
}
var description = fn.name ? decamelize(fn.name, '-') : 'generated-value';
return ['(', description, ')'].join('');
}
// format the default-value-string displayed in

@@ -229,5 +237,2 @@ // the right-hand column.

break;
case 'function':
string += '(' + (value.name.length ? decamelize(value.name, '-') : 'generated-value') + ')'
break;
default:

@@ -234,0 +239,0 @@ string += value;

{
"name": "yargs",
"version": "3.5.4",
"version": "3.6.0",
"description": "Light-weight option parsing with an argv hash. No optstrings attached.",

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

@@ -690,6 +690,6 @@ yargs

.showHelp(fn=console.error)
.showHelp(consoleLevel='error')
---------------------------
Print the usage data using `fn` for printing.
Print the usage data using the [`console`](https://nodejs.org/api/console.html) function `consoleLevel` for printing.

@@ -704,2 +704,8 @@ Example:

Or, to print the usage data to `stdout` instead, you can specify the use of `console.log`:
```
yargs.showHelp("log");
```
Later on, ```argv``` can be retrived with ```yargs.argv```

@@ -706,0 +712,0 @@

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