Empty array values being ignored
Open
Nobody has claimed this yet.
bug
needs investigation
p1
- Dominant language
- JavaScript
- Stars
- 519
- Forks
- 129
- Avg merge
- 1h 34m
- Merged PRs (30d)
- 1
Description
Hi!
I have a program that passes positional arguments to another program, and discovered that empty strings are removed from the final array.
The folowing code:
var yargs = require('yargs');
var argv = yargs
.options('A', {
type: 'array'
}).argv;
console.log(argv.A);
node .\index.js -A=test1 -A= -A=test3 -A=
Outputs:
[ 'test1', 'test3' ]
Expected:
[ 'test1', '', 'test3', '' ]
Versions:
yargs: 13.3.0
yargs-parser: 13.1.1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the reported Node.js command with yargs 13.3.0 and yargs-parser 13.1.1, focusing on repeated -A array arguments with empty values. Done means the resulting argv.A preserves each empty string in its original position, matching the expected array.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100