1. License
“Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.”
Any use, with or without a fee, is allowed under ISC.
github.com/yargs/yargs-parser/blob/main/LICENSE.txt3. Used by agents' projects
Dependency in 3 public GitHub projects set up for AI coding agents that we scanned (0.0%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error
What yargs-parser does
yargs-parser is a small free JavaScript library that reads options typed after a command, like "--width 1200 --dry-run", and gives your code ready values. Numbers become numbers, on-off switches become true or false, and other words are kept in a list. It is the part of the yargs toolkit that only reads options; it does not print help or check for mistakes.
What people build with it
Options for your own script
You have a small Node.js script that resizes photos or cleans a folder. It reads "-w 1200 --dry-run" without you splitting the text by hand.
Commands typed in a chat box
A team chat bot or a web console gets "/deploy --env staging --force" as one line of text and needs the parts as values.
A command box in a web page
A tutorial site or an in-browser playground lets visitors type options, and the page reads them without a server.
Quiet, normal or chatty output
Your tool prints more detail with -v and even more with -vvv; the library counts the letters for you.
Pass extra words to another program
A wrapper script keeps everything after "--" untouched and hands it to the program it starts, like a test runner.
yargs-parser popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How yargs-parser is used
- yargs-parser joined the catalog on its public numbers (394,038,993 downloads a week on npm and 520 GitHub stars), not on our project count: it is a dependency in 6 public GitHub projects of our scan, 3 of them set up for AI coding agents.
- The most used alternative in our scan is Commander (174 projects).
- Projects that use it most often also use tsx (66.7%), Prettier (66.7%), Vitest (66.7%).
Often used with
More about yargs-parser
Funding
- GitHub Sponsors: https://github.com/shadowspawn
- thanks.dev: https://thanks.dev/u/gh/shadowspawn
- Tidelift: https://tidelift.com/funding/github/npm/yargs-parser
- 4 GitHub sponsors
More in Dev workflow and config
Alternatives
yargs-parser This page
Pick yargs when your tool needs automatic help and usage text, commands and checks, not only the raw values.
Pick Commander for a complete command-line app with sub-commands and help with little setup.
Pick minimist when you want an even smaller option reader with fewer settings.
Get started
Tell your AI assistant
“Use yargs-parser (pin yargs-parser@22.0.0, Node.js 20.19+ or 22.12+) to read the options of our script; declare number, boolean, array and string options and defaults, and turn greedy-arrays off if a list option comes before file names.”
Add the package to your project.
npm i yargs-parser --savePass it the words after your command, or one string, and read the result.
const argv = require('yargs-parser')(process.argv.slice(2)) console.log(argv)Tell it which options are numbers, switches, lists or text, and give defaults.
import parser from 'yargs-parser' const argv = parser('--foo=99 --bar=9987930', { string: ['bar'] })
Mistakes to avoid
Version 22 is published as an ES module only and lists those Node.js versions as its minimum.
A list option keeps taking the following words; in our run photo.jpg ended up inside format.
Unknown options are accepted as new keys; in our run --output-dir became outputDir with no error.
The README asks for strings; convert mixed values before you pass them.
The plain call returns values only; detailed() also returns the error, as in our run with narg.
Questions
Does it print a --help screen?
No. It only turns the typed words into values; yargs, which is built on it, adds help and usage text.
Can I give it one string instead of a list of words?
Yes. It takes a string or a list of strings.
Does --no-color work?
Yes. By default an option that starts with --no- is read as that option set to false.
Does it work in the browser?
Yes, through its browser entry, since version 19. Loading settings from files is not supported there.
Can I use it in a paid product?
Yes. The ISC license allows any use with or without a fee; keep the notice in copies.