Catalog npm
Back to packageRELEASE DETAILS

0.2.4

npm

minimist

parse argument options

argvgetoptoptimistparser
Published25 Feb 2023
Direct dependencies9
Transitive dependenciesNot calculated

README

Version 0.2.4 documentation

minimist Version Badge

github actions coverage License Downloads

npm badge

parse argument options

This module is the guts of optimist's argument parser without all the fanciful decoration.

browser support

build status

example

var argv = require('minimist')(process.argv.slice(2));
console.dir(argv);
$ node example/parse.js -a beep -b boop
{ _: [], a: 'beep', b: 'boop' }
$ node example/parse.js -x 3 -y 4 -n5 -abc --beep=boop foo bar baz
{
	_: ['foo', 'bar', 'baz'],
	x: 3,
	y: 4,
	n: 5,
	a: true,
	b: true,
	c: true,
	beep: 'boop'
}

methods

var parseArgs = require('minimist')

var argv = parseArgs(args, opts={})

Return an argument object argv populated with the array arguments from args.

argv._ contains all the arguments that didn't have an option associated with them.

Numeric-looking arguments will be returned as numbers unless opts.string or opts.boolean is set for that argument name.

Any arguments after '--' will not be parsed and will end up in argv._.

options can be:

  • opts.string - a string or array of strings argument names to always treat as strings
  • opts.boolean - a boolean, string or array of strings to always treat as booleans. if true will treat all double hyphenated arguments without equal signs as boolean (e.g. affects --foo, not -f or --foo=bar)
  • opts.alias - an object mapping string names to strings or arrays of string argument names to use as aliases
  • opts.default - an object mapping string argument names to default values
  • opts['--'] - when true, populate argv._ with everything before the -- and argv['--'] with everything after the --. Here's an example:
> require('./')('one two three -- four five --six'.split(' '), { '--': true })
{
	_: ['one', 'two', 'three'],
	'--': ['four', 'five', '--six'],
}

Note that with opts['--'] set, parsing for arguments still stops after the --.

install

With npm do:

npm install minimist

license

MIT

Downloads & popularity

142,057downloads
7-day window · source-reported counts20 Oct 2026
142.1K71K0
2026-10-20: 142,057 · observed 2026-10-20T13:48:36.9116080Z
20 Oct20 Oct

npm · 1 observations shown. Missing days are unknown.

View observed values
Date / source periodValueObserved at
2026-10-20142,0572026-10-20T13:48:36.9116080Z

Declared dependencies 9

Native requirements
9 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
aud
Environment
{
  "local_name": "aud",
  "alias": false,
  "peer_metadata": null
}
^2.0.2development
nyc
Environment
{
  "local_name": "nyc",
  "alias": false,
  "peer_metadata": null
}
^10.3.2development
tape
Environment
{
  "local_name": "tape",
  "alias": false,
  "peer_metadata": null
}
^5.6.3development
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
=8.8.0development
npmignore
Environment
{
  "local_name": "npmignore",
  "alias": false,
  "peer_metadata": null
}
^0.3.0development
in-publish
Environment
{
  "local_name": "in-publish",
  "alias": false,
  "peer_metadata": null
}
^2.0.1development
auto-changelog
Environment
{
  "local_name": "auto-changelog",
  "alias": false,
  "peer_metadata": null
}
^2.4.0development
safe-publish-latest
Environment
{
  "local_name": "safe-publish-latest",
  "alias": false,
  "peer_metadata": null
}
^2.0.0development
@ljharb/eslint-config
Environment
{
  "local_name": "@ljharb/eslint-config",
  "alias": false,
  "peer_metadata": null
}
^21.0.1development

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "0085d5501e29033748a2f2a4da0180142697a475",
  "tarball": "https://registry.npmjs.org/minimist/-/minimist-0.2.4.tgz",
  "fileCount": 21,
  "integrity": "sha512-Pkrrm8NjyQ8yVt8Am9M+yUt74zE3iokhzbG1bFVNjLB92vwM71hf40RkEsryg98BujhVOncKm/C1xROxZ030LQ==",
  "signatures": [
    {
      "sig": "MEYCIQDC8bKV5QnJnci7N9gRT4Dxzt7loH1NysMhDbpNpiR3/gIhALl3ggxiPPWDaxPjy2CopwK3uiqjKAWgBOflYTVGulCX",
      "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"
    }
  ],
  "unpackedSize": 48940,
  "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJj+ageACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpoZw/9Hi0sCVeQtVDQatxiwswU3fAhx1z6n02WfQVy0snRCY35d7Jp\r\nWMNkesM5exIUtm3g+v8pSk13UKEqw1SFyBBwVi26DJhQVeNUnaEX/q4nPrHF\r\nb0axV/FGCKhNrkiJpb0a1K1/vqFybnoq3X2QY4P7ALmgGTX8Dm/64KLpMZEP\r\nk2UDNuTnNRnjeWdO6mO6CKzhhvYfeeT+Wl5UAfCWZQVHBlzwVXh6zTQN8g3L\r\nSl0e1+kE35mBzXnP6K9SVof8LY1/3Ggamr0xGI81KAMGUo7QrCIBzgzYS8uH\r\nnFHLG/+sIaAHRV7c/EyCoJoDdsXw/2LF/Ty/81Vg0YOVYb5PBh71+TUOrPrD\r\ndhO4x3/xOUxeJgdFErJESKhmUy+oXlyiudgyv44gGSsKF8W2PuK4KUTTJGsO\r\nFZZMJDtMKne3o5K7z11tZreA9lPDsVThDiPtlRJypllm26iG4YgYirQ2nVs6\r\nky4HI4qnlhC8Qs5L06atYJMvHY0HVoUGMRKTdLDVDywdaA1D54wGg2pOpTYW\r\nMPVffCgsi92JnNCKkn9o7HVCN3u/ZugZRqND0JL1BSI/AVlCWtK2Jjlaiw0F\r\nIhJnMdiKTak9QafJEzbqgRYMXFVP2CP2hFbK/mV8duCCkAoJLME3744PoLhO\r\na2AKcIGxP4FdQJirELoSeDzVEKXjck1HzTk=\r\n=WBqU\r\n-----END PGP SIGNATURE-----\r\n"
}

Repository

PENDING
substack/minimist

Shared repository data · GitHub

License detected in repository
Not collected

Repository

PENDING
minimistjs/minimist

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 09:11 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:ed48b5e1b7cd7148469956c7b19ec73c650e4bb0d3f2302cbceca9e2a5b66162

Other collected versions

1.2.89 Feb0.2.39 Feb0.2.211 Oct1.2.711 Oct1.2.622 Mar1.2.512 MarView all collected versions →