Gathering detailed insights and metrics for yargs-unparser-custom-flag
Gathering detailed insights and metrics for yargs-unparser-custom-flag
Gathering detailed insights and metrics for yargs-unparser-custom-flag
Gathering detailed insights and metrics for yargs-unparser-custom-flag
convert back a yargs argv object to its original array form
npm install yargs-unparser-custom-flag
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
21 Stars
99 Commits
13 Forks
6 Watchers
56 Branches
18 Contributors
Updated on Jun 02, 2025
Latest Version
2.0.0
Package Id
yargs-unparser-custom-flag@2.0.0
Unpacked Size
10.35 kB
Size
4.06 kB
File Count
4
NPM Version
9.5.0
Node Version
18.15.0
Published on
Jun 05, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
7
Converts back a yargs
argv object to its original array form.
Probably the unparser word doesn't even exist, but it sounds nice and goes well with yargs-parser.
The code originally lived in MOXY's GitHub but was later moved here for discoverability.
$ npm install yargs-unparser
1const parse = require('yargs-parser'); 2const unparse = require('yargs-unparser'); 3 4const argv = parse(['--no-boolean', '--number', '4', '--string', 'foo'], { 5 boolean: ['boolean'], 6 number: ['number'], 7 string: ['string'], 8}); 9// { boolean: false, number: 4, string: 'foo', _: [] } 10 11const unparsedArgv = unparse(argv); 12// ['--no-boolean', '--number', '4', '--string', 'foo'];
The second argument of unparse
accepts an options object:
alias
: The aliases so that duplicate options aren't generateddefault
: The default values so that the options with default values are omittedcommand
: The command first argument so that command names and positional arguments are handled correctlycommand
options1const yargs = require('yargs'); 2const unparse = require('yargs-unparser'); 3 4const argv = yargs 5 .command('my-command <positional>', 'My awesome command', (yargs) => 6 yargs 7 .option('boolean', { type: 'boolean' }) 8 .option('number', { type: 'number' }) 9 .option('string', { type: 'string' }) 10 ) 11 .parse(['my-command', 'hello', '--no-boolean', '--number', '4', '--string', 'foo']); 12// { positional: 'hello', boolean: false, number: 4, string: 'foo', _: ['my-command'] } 13 14const unparsedArgv = unparse(argv, { 15 command: 'my-command <positional>', 16}); 17// ['my-command', 'hello', '--no-boolean', '--number', '4', '--string', 'foo'];
The returned array can be parsed again by yargs-parser
using the default configuration. If you used custom configuration that you want yargs-unparser
to be aware, please fill an issue.
If you coerce
in weird ways, things might not work correctly.
$ npm test
$ npm test -- --watch
during development
Libraries in this ecosystem make a best effort to track Node.js' release schedule. Here's a post on why we think this is important.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
Found 5/17 approved changesets -- score normalized to 2
Reason
dependency not pinned by hash detected -- score normalized to 2
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
23 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More