Socket
Socket
Sign inDemoInstall

yargs-parser

Package Overview
Dependencies
2
Maintainers
2
Versions
83
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.1.0 to 3.2.0

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="3.2.0"></a>
# [3.2.0](https://github.com/yargs/yargs-parser/compare/v3.1.0...v3.2.0) (2016-08-13)
### Features
* coerce full array instead of each element ([#51](https://github.com/yargs/yargs-parser/issues/51)) ([cc4dc56](https://github.com/yargs/yargs-parser/commit/cc4dc56))
<a name="3.1.0"></a>

@@ -7,0 +17,0 @@ # [3.1.0](https://github.com/yargs/yargs-parser/compare/v3.0.0...v3.1.0) (2016-08-09)

19

index.js

@@ -283,2 +283,3 @@ var assign = require('lodash.assign')

applyEnvVars(argv, false)
applyArrayCoercions(argv)
applyDefaultsAndAliases(argv, flags.aliases, defaults)

@@ -486,2 +487,18 @@

function applyArrayCoercions (argv) {
var coerce
Object.keys(argv).filter(function (key) {
return key === '_' || checkAllAliases(key, flags.arrays)
}).forEach(function (key) {
coerce = checkAllAliases(key, flags.coercions)
if (typeof coerce === 'function') {
try {
argv[key] = coerce(argv[key])
} catch (err) {
error = err
}
}
})
}
function applyDefaultsAndAliases (obj, aliases, defaults) {

@@ -526,3 +543,3 @@ Object.keys(defaults).forEach(function (key) {

var key = keys[keys.length - 1]
var coerce = checkAllAliases(key, flags.coercions)
var coerce = !checkAllAliases(key, flags.arrays) && checkAllAliases(key, flags.coercions)
if (typeof coerce === 'function') {

@@ -529,0 +546,0 @@ try {

2

package.json
{
"name": "yargs-parser",
"version": "3.1.0",
"version": "3.2.0",
"description": "the mighty option parser used by yargs",

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

@@ -6,7 +6,7 @@ # yargs-parser

[![NPM version](https://img.shields.io/npm/v/yargs-parser.svg)](https://www.npmjs.com/package/yargs-parser)
[![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/yargs-parser/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/bcoe/yargs-parser)
[![Windows Tests](https://img.shields.io/appveyor/ci/bcoe/yargs-parser/master.svg?label=Windows%20Tests)](https://ci.appveyor.com/project/yargs/yargs-parser)
[![Standard Version](https://img.shields.io/badge/release-standard%20version-brightgreen.svg)](https://github.com/conventional-changelog/standard-version)
The mighty option parser used by [yargs](https://github.com/bcoe/yargs).
The mighty option parser used by [yargs](https://github.com/yargs/yargs).

@@ -24,3 +24,3 @@ visit the [yargs website](http://yargs.js.org/) for more examples, and thorough usage instructions.

```js
var argv = require('yargs-parser')(process.argv.slice(2));
var argv = require('yargs-parser')(process.argv.slice(2))
console.log(argv)

@@ -37,3 +37,3 @@ ```

```js
var argv = require('./')('--foo=99 --bar=33');
var argv = require('./')('--foo=99 --bar=33')
console.log(argv)

@@ -46,2 +46,10 @@ ```

Convert an array of mixed types before passing to `yargs-parser`:
```js
var parse = require('yargs-parser')
parse(['-f', 11, '--zoom', 55].join(' ')) // <-- array to string
parse(['-f', 11, '--zoom', 55].map(String)) // <-- array of strings
```
## API

@@ -55,3 +63,3 @@

* `args`: an array or string representing the options to parse.
* `args`: a string or array of strings representing the options to parse.
* `opts`: provide a set of hints indicating how `args` should be parsed:

@@ -86,3 +94,3 @@ * `opts.alias`: an object representing the set of aliases for a key: `{alias: {foo: ['f']}}`.

* `args`: an array or string representing options to parse.
* `args`: a string or array of strings representing options to parse.
* `opts`: provide a set of hints indicating how `args`, inputs are identical to `require('yargs-parser')(args, opts={})`.

@@ -89,0 +97,0 @@

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