|
|
8 years ago | |
|---|---|---|
| .. | ||
| index.js | 8 years ago | |
| license | 8 years ago | |
| package.json | 8 years ago | |
| readme.md | 8 years ago | |
Check if
argvhas a specific flag
Correctly stops looking after an -- argument terminator.
$ npm install --save has-flag
// foo.js
var hasFlag = require('has-flag');
hasFlag('unicorn');
//=> true
hasFlag('--unicorn');
//=> true
hasFlag('foo=bar');
//=> true
hasFlag('foo');
//=> false
hasFlag('rainbow');
//=> false
$ node foo.js --unicorn --foo=bar -- --rainbow
Returns a boolean whether the flag exists.
Type: string
CLI flag to look for. The -- prefix is optional.
Type: array
Default: process.argv
CLI arguments.
MIT © Sindre Sorhus