Gathering detailed insights and metrics for minimist-options
Gathering detailed insights and metrics for minimist-options
Gathering detailed insights and metrics for minimist-options
Gathering detailed insights and metrics for minimist-options
minimist
parse argument options
dargs
Reverse minimist. Convert an object of options into an array of command-line arguments.
mri
Quickly scan for CLI flags and arguments
@types/minimist-options
Stub TypeScript definitions entry for minimist-options, which provides its own types definitions
npm install minimist-options
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (84.19%)
TypeScript (15.81%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
53 Stars
46 Commits
17 Forks
2 Watchers
1 Branches
9 Contributors
Updated on Mar 10, 2025
Latest Version
4.1.0
Package Id
minimist-options@4.1.0
Size
3.39 kB
NPM Version
6.12.1
Node Version
12.13.1
Published on
May 16, 2020
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
3
4
Write options for minimist and yargs in a comfortable way. Supports string, boolean, number and array options.
$ npm install --save minimist-options
1const buildOptions = require('minimist-options');
2const minimist = require('minimist');
3
4const options = buildOptions({
5 name: {
6 type: 'string',
7 alias: 'n',
8 default: 'john'
9 },
10
11 force: {
12 type: 'boolean',
13 alias: ['f', 'o'],
14 default: false
15 },
16
17 score: {
18 type: 'number',
19 alias: 's',
20 default: 0
21 },
22
23 arr: {
24 type: 'array',
25 alias: 'a',
26 default: []
27 },
28
29 strings: {
30 type: 'string-array',
31 alias: 's',
32 default: ['a', 'b']
33 },
34
35 booleans: {
36 type: 'boolean-array',
37 alias: 'b',
38 default: [true, false]
39 },
40
41 numbers: {
42 type: 'number-array',
43 alias: 'n',
44 default: [0, 1]
45 },
46
47 published: 'boolean',
48
49 // Special option for positional arguments (`_` in minimist)
50 arguments: 'string'
51});
52
53const args = minimist(process.argv.slice(2), options);
instead of:
1const minimist = require('minimist'); 2 3const options = { 4 string: ['name', '_'], 5 number: ['score'], 6 array: [ 7 'arr', 8 {key: 'strings', string: true}, 9 {key: 'booleans', boolean: true}, 10 {key: 'numbers', number: true} 11 ], 12 boolean: ['force', 'published'], 13 alias: { 14 n: 'name', 15 f: 'force', 16 s: 'score', 17 a: 'arr' 18 }, 19 default: { 20 name: 'john', 21 f: false, 22 score: 0, 23 arr: [] 24 } 25}; 26 27const args = minimist(process.argv.slice(2), options);
The array
types are only supported by yargs.
minimist does not explicitly support array type options. If you set an option multiple times, it will indeed yield an array of values. However, if you only set it once, it will simply give the value as is, without wrapping it in an array. Thus, effectively ignoring {type: 'array'}
.
{type: 'array'}
is shorthand for {type: 'string-array'}
. To have values coerced to boolean
or number
, use boolean-array
or number-array
, respectively.
MIT © Vadim Demedes
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 8/29 approved changesets -- score normalized to 2
Reason
detected GitHub workflow tokens with excessive permissions
Details
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
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
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
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