1 # has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag)
3 > Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag
5 Correctly stops looking after an `--` argument terminator.
11 <a href="https://tidelift.com/subscription/pkg/npm-has-flag?utm_source=npm-has-flag&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
15 Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
25 $ npm install has-flag
33 const hasFlag = require('has-flag');
58 $ node foo.js -f --unicorn --foo=bar -- --rainbow
64 ### hasFlag(flag, [argv])
66 Returns a boolean for whether the flag exists.
72 CLI flag to look for. The `--` prefix is optional.
77 Default: `process.argv`
84 To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure.
89 MIT © [Sindre Sorhus](https://sindresorhus.com)