Bachir Soussi Chiadmi ac58a24f5c added bower, gulp | 7 years ago | |
---|---|---|
.. | ||
index.js | 7 years ago | |
license | 7 years ago | |
package.json | 7 years ago | |
readme.md | 7 years ago |
Check if
argv
has 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