Socket
Socket
Sign inDemoInstall

yargs

Package Overview
Dependencies
1
Maintainers
1
Versions
250
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.0 to 1.2.1

15

lib/minimist.js

@@ -29,2 +29,8 @@ var path = require('path');

function toCamelCase(str) {
return str.split('-').map(function(word, i) {
return (i ? word[0].toUpperCase() + word.slice(1) : word);
}).join('');
}
var aliases = {};

@@ -36,6 +42,3 @@ Object.keys(opts.alias || {}).forEach(function (key) {

if (/-/.test(x)) {
aliases[key].push(
x.split('-').map(function(word, i) {
return (i ? word[0].toUpperCase() + word.slice(1) : word);
}).join(''));
aliases[key].push(toCamelCase(x));
}

@@ -65,2 +68,6 @@ });

function setArg (key, val) {
if (/-/.test(key) && !(aliases[key] && aliases[key].length)) {
aliases[key] = [toCamelCase(key)];
}
var value = !flags.strings[key] && isNumber(val) ? Number(val) : val;

@@ -67,0 +74,0 @@

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

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

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

var result = yargs()
.parse([ '--some-option' ]);
result.should.have.property('someOption').that.is.a('boolean').and.is.true;
});
it('should provide count options with dashes as camelCase properties', function () {
var result = yargs()
.option('some-option', {
describe : 'some option',
type : 'count'
})
.parse([ '--some-option', '--some-option', '--some-option' ]);
result.should.have.property('someOption', 3);
});
it('should provide options with dashes and aliases as camelCase properties', function () {
var result = yargs()
.option('some-option', {
alias : 'o',

@@ -13,0 +31,0 @@ describe : 'some option'

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc