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

yargs-parser

Package Overview
Dependencies
Maintainers
3
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

yargs-parser - npm Package Compare versions

Comparing version 17.1.0 to 18.0.0

11

CHANGELOG.md

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

## [18.0.0](https://www.github.com/yargs/yargs-parser/compare/v17.1.0...v18.0.0) (2020-03-02)
### ⚠ BREAKING CHANGES
* the narg count is now enforced when parsing arrays.
### Features
* NaN can now be provided as a value for nargs, indicating "at least" one value is expected for array ([#251](https://www.github.com/yargs/yargs-parser/issues/251)) ([9db4be8](https://www.github.com/yargs/yargs-parser/commit/9db4be81417a2c7097128db34d86fe70ef4af70c))
## [17.1.0](https://www.github.com/yargs/yargs-parser/compare/v17.0.1...v17.1.0) (2020-03-01)

@@ -7,0 +18,0 @@

17

index.js

@@ -364,3 +364,6 @@ const camelCase = require('camelcase')

let ii
const toEat = checkAllAliases(key, flags.nargs)
let toEat = checkAllAliases(key, flags.nargs)
// NaN has a special meaning for the array type, indicating that one or
// more values are expected.
toEat = isNaN(toEat) ? 1 : toEat

@@ -401,2 +404,4 @@ if (toEat === 0) {

let next = args[i + 1]
// If both array and nargs are configured, enforce the nargs count:
const nargsCount = checkAllAliases(key, flags.nargs)

@@ -418,3 +423,4 @@ if (checkAllAliases(key, flags.bools) && !(/^(true|false)$/.test(next))) {

argsToSet.push(processValue(key, next))
if (!configuration['greedy-arrays']) break
if (!configuration['greedy-arrays'] ||
(nargsCount && argsToSet.length >= nargsCount)) break
}

@@ -424,5 +430,6 @@ }

// If both array and nargs are configured, create an error if less than
// nargs positionals were found:
const toEat = checkAllAliases(key, flags.nargs)
if (toEat && argsToSet.length < toEat) {
// nargs positionals were found. NaN has special meaning, indicating
// that at least one value is required (more are okay).
if ((nargsCount && argsToSet.length < nargsCount) ||
(isNaN(nargsCount) && argsToSet.length === 0)) {
error = Error(__('Not enough arguments following: %s', key))

@@ -429,0 +436,0 @@ }

{
"name": "yargs-parser",
"version": "17.1.0",
"version": "18.0.0",
"description": "the mighty option parser used by yargs",

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

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