has-flag
npmv5.0.1Check if argv has a specific flag
Overview
has-flag is an npm package that check if argv has a specific flag. It is extremely widely used, with about 295.4M downloads per week and 1 known dependents in the graph. The latest version is 5.0.1, released under the MIT license.
Who should use it
Teams working in the npm ecosystem who need check if argv has a specific flag and value a battle-tested, widely-adopted solution.
When not to use it
Consider an alternative if you need to have first-class TypeScript types out of the box, or if a more actively-maintained option better fits your npm stack.
Pros
- Large, well-established user base (295.4M weekly downloads).
- Clear open-source license (MIT).
- Lean dependency tree (3 direct dependencies).
Cons
- No bundled TypeScript types (may require a separate @types package).
Auto-generated from collected registry metadata. No external claims are inferred.
Relationship graph
Dependencies (left) and dependents (right) of has-flag.
Dependencies
Dev (3)
Used by
Popular packages that depend on has-flag.
Alternatives to has-flag
the complete solution for node.js command-line programs
yargs the modern, pirate-themed, successor to optimist.
Parse CLI arguments.
the mighty option parser used by yargs
Detect whether a terminal supports hyperlinks
Open stuff like URLs, files, executables. Cross-platform.
Check if the process is running inside Windows Subsystem for Linux (Bash on Windows)
Colored symbols for various log levels. Example: `✔︎ Success`
Check if the process is running in an SSH session
Check if the process is running inside a container (Docker/Podman)
Check if the process is running inside a Docker container
easily create complex multi-column command-line-interfaces
Version history
| Version | Published | License |
|---|---|---|
| 5.0.1latest | 5 years ago | MIT |
| 5.0.0 | 5 years ago | MIT |
| 4.0.0 | 7 years ago | MIT |
| 3.0.0 | 8 years ago | MIT |
| 2.0.0 | 10 years ago | MIT |
| 1.0.0 | 11 years ago | MIT |
Maintainers
Funding
Frequently asked questions
How do I install has-flag?
Run `npm install has-flag` to add has-flag to your npm project.
What license is has-flag released under?
has-flag is distributed under the MIT license.
How popular is has-flag?
has-flag has approximately 295,445,725 downloads per week and 1 known dependent packages.