Gathering detailed insights and metrics for dargs
Gathering detailed insights and metrics for dargs
Gathering detailed insights and metrics for dargs
Gathering detailed insights and metrics for dargs
@types/dargs
Stub TypeScript definitions entry for dargs, which provides its own types definitions
dargs-object
Fork of https://github.com/sindresorhus/dargs. Converts an object of options into an array of command-line arguments. Useful when calling command-line tools. Now object-aware
@hela/dargs
Helper that does the opposite of minimist/mri, enhanced fork of sindersorhus/dargs.
dargs-fork
Patch for the [dargs][] package, that adds support for single flags. Convert an object of options into an array of command-line arguments.
Reverse minimist. Convert an object of options into an array of command-line arguments
npm install dargs
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.8
Supply Chain
99.5
Quality
75.9
Maintenance
100
Vulnerability
100
License
JavaScript (86.25%)
TypeScript (13.75%)
Total Downloads
1,314,958,222
Last Day
440,054
Last Week
7,847,046
Last Month
34,002,506
Last Year
330,433,077
MIT License
185 Stars
69 Commits
23 Forks
10 Watchers
1 Branches
14 Contributors
Updated on Jan 07, 2025
Minified
Minified + Gzipped
Latest Version
8.1.0
Package Id
dargs@8.1.0
Size
3.79 kB
NPM Version
7.10.0
Node Version
12.22.1
Published on
Jun 30, 2021
Cumulative downloads
Total Downloads
Last Day
-14.6%
440,054
Compared to previous day
Last Week
-9.1%
7,847,046
Compared to previous week
Last Month
8.2%
34,002,506
Compared to previous month
Last Year
26.6%
330,433,077
Compared to previous year
Reverse
minimist
. Convert an object of options into an array of command-line arguments.
Useful when spawning command-line tools.
$ npm install dargs
1import dargs from 'dargs'; 2 3const object = { 4 _: ['some', 'option'], // Values in '_' will be appended to the end of the generated argument list 5 '--': ['separated', 'option'], // Values in '--' will be put at the very end of the argument list after the escape option (`--`) 6 foo: 'bar', 7 hello: true, // Results in only the key being used 8 cake: false, // Prepends `no-` before the key 9 camelCase: 5, // CamelCase is slugged to `camel-case` 10 multiple: ['value', 'value2'], // Converted to multiple arguments 11 pieKind: 'cherry', 12 sad: ':(' 13}; 14 15const excludes = ['sad', /.*Kind$/]; // Excludes and includes accept regular expressions 16const includes = ['camelCase', 'multiple', 'sad', /^pie.*/]; 17const aliases = {file: 'f'}; 18 19console.log(dargs(object, {excludes})); 20/* 21[ 22 '--foo=bar', 23 '--hello', 24 '--no-cake', 25 '--camel-case=5', 26 '--multiple=value', 27 '--multiple=value2', 28 'some', 29 'option', 30 '--', 31 'separated', 32 'option' 33] 34*/ 35 36console.log(dargs(object, {excludes, includes})); 37/* 38[ 39 '--camel-case=5', 40 '--multiple=value', 41 '--multiple=value2' 42] 43*/ 44 45 46console.log(dargs(object, {includes})); 47/* 48[ 49 '--camel-case=5', 50 '--multiple=value', 51 '--multiple=value2', 52 '--pie-kind=cherry', 53 '--sad=:(' 54] 55*/ 56 57 58console.log(dargs({ 59 foo: 'bar', 60 hello: true, 61 file: 'baz' 62}, {aliases})); 63/* 64[ 65 '--foo=bar', 66 '--hello', 67 '-f', 'baz' 68] 69*/
Type: object
Object to convert to command-line arguments.
Type: object
Type: Array<string | RegExp>
Keys or regex of keys to exclude. Takes precedence over includes
.
Type: Array<string | RegExp>
Keys or regex of keys to include.
Type: object
Maps keys in object
to an aliased name. Matching keys are converted to arguments with a single dash (-
) in front of the aliased key and the value in a separate array item. Keys are still affected by includes
and excludes
.
Type: boolean
Default: true
Setting this to false
makes it return the key and value as separate array items instead of using a =
separator in one item. This can be useful for tools that doesn't support --foo=bar
style flags.
1import dargs from 'dargs'; 2 3console.log(dargs({foo: 'bar'}, {useEquals: false})); 4/* 5[ 6 '--foo', 'bar' 7] 8*/
Type: boolean
Default: true
Make a single character option key {a: true}
become a short flag -a
instead of --a
.
1import dargs from 'dargs'; 2 3console.log(dargs({a: true})); 4//=> ['-a'] 5 6console.log(dargs({a: true}, {shortFlag: false})); 7//=> ['--a']
Type: boolean
Default: false
Exclude true
values. Can be useful when dealing with argument parsers that only expect negated arguments like --no-foo
.
Type: boolean
Default: false
Exclude false
values. Can be useful when dealing with strict argument parsers that throw on unknown arguments like --no-foo
.
Type: boolean
Default: false
By default, camel-cased keys will be hyphenated. Enabling this will bypass the conversion process.
1import dargs from 'dargs'; 2 3console.log(dargs({fooBar: 'baz'})); 4//=> ['--foo-bar', 'baz'] 5 6console.log(dargs({fooBar: 'baz'}, {allowCamelCase: true})); 7//=> ['--fooBar', 'baz']
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 7/30 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
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