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 $ npm install has-flag
19 const hasFlag = require('has-flag');
44 $ node foo.js -f --unicorn --foo=bar -- --rainbow
50 ### hasFlag(flag, [argv])
52 Returns a boolean for whether the flag exists.
58 CLI flag to look for. The `--` prefix is optional.
63 Default: `process.argv`
70 MIT © [Sindre Sorhus](https://sindresorhus.com)