|
Download node_modules/has-flag/readme.md from Thrisha04/Chat: direct link, hf CLI and curl.
- Browser
- Download file 986 Bytes
-
https://huggingface.co/Thrisha04/Chat/resolve/main/node_modules/has-flag/readme.md
- Command line
-
hf download hf://Thrisha04/Chat/node_modules/has-flag/readme.md
-
curl -L -o readme.md https://huggingface.co/Thrisha04/Chat/resolve/main/node_modules/has-flag/readme.md
986 Bytes
has-flag
Check if
argvhas a specific flag
Correctly stops looking after an -- argument terminator.
Install
$ npm install has-flag
Usage
// foo.js
const hasFlag = require('has-flag');
hasFlag('unicorn');
//=> true
hasFlag('--unicorn');
//=> true
hasFlag('f');
//=> true
hasFlag('-f');
//=> true
hasFlag('foo=bar');
//=> true
hasFlag('foo');
//=> false
hasFlag('rainbow');
//=> false
$ node foo.js -f --unicorn --foo=bar -- --rainbow
API
hasFlag(flag, [argv])
Returns a boolean for whether the flag exists.
flag
Type: string
CLI flag to look for. The -- prefix is optional.
argv
Type: string[]
Default: process.argv
CLI arguments.
License
MIT © Sindre Sorhus