Socket
Socket
Sign inDemoInstall

yargs

Package Overview
Dependencies
Maintainers
1
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 1.3.2 to 1.3.3

9

lib/minimist.js

@@ -60,4 +60,8 @@ var path = require('path');

var c = toCamelCase(key);
aliases[key] = (aliases[key] || []).concat(c);
newAliases[c] = true;
aliases[key] = aliases[key] || [];
// don't allow the same key to be added multiple times.
if (aliases[key].indexOf(c) === -1) {
aliases[key] = (aliases[key] || []).concat(c);
newAliases[c] = true;
}
}

@@ -75,3 +79,2 @@ (aliases[key] || []).forEach(function (alias) {

var notFlags = [];
if (args.indexOf('--') !== -1) {

@@ -78,0 +81,0 @@ notFlags = args.slice(args.indexOf('--')+1);

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

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

@@ -18,3 +18,3 @@ var should = require('chai').should(),

});
it('should place bare options in the _ array', function () {

@@ -42,3 +42,3 @@ var parse = yargs.parse(['foo', 'bar', 'baz']);

});
it('should set the value of a single short option to the next supplied value', function () {

@@ -90,3 +90,3 @@ var parse = yargs.parse(['-h', 'localhost']);

});
it('should still set values appropriately if a mix of short and long options are specified', function () {

@@ -104,3 +104,3 @@ var parse = yargs.parse(['-h', 'localhost', '--port', '555']);

});
it('should group values into an array if the same option is specified multiple times', function () {

@@ -111,3 +111,3 @@ var parse = yargs.parse(['-v', 'a', '-v', 'b', '-v', 'c' ]);

});
it('should still set values appropriately if we supply a comprehensive list of various types of options', function () {

@@ -360,2 +360,36 @@ var parse = yargs.parse([

// regression, see https://github.com/chevex/yargs/issues/63
it('should not add the same key to argv multiple times, when creating camel-case aliases', function() {
var yargs = require('../')(['--health-check=banana', '--second-key', 'apple', '-t=blarg'])
.options('h', {
alias: 'health-check',
description: 'health check',
default: 'apple'
})
.options('second-key', {
alias: 's',
description: 'second key',
default: 'banana'
})
.options('third-key', {
alias: 't',
description: 'third key',
default: 'third'
})
// before this fix, yargs failed parsing
// one but not all forms of an arg.
yargs.argv.secondKey.should.eql('apple');
yargs.argv.s.should.eql('apple');
yargs.argv['second-key'].should.eql('apple');
yargs.argv.healthCheck.should.eql('banana');
yargs.argv.h.should.eql('banana');
yargs.argv['health-check'].should.eql('banana');
yargs.argv.thirdKey.should.eql('blarg');
yargs.argv.t.should.eql('blarg');
yargs.argv['third-key'].should.eql('blarg');
});
});
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