云盘
志元云盘
备份云盘
Home
/
志元云盘
/
webdav
/
home
/
jcore
/
web
/
front_end
/
node_modules
/
has-flag
File
OriginalPic
Thumbnails
CopyAllDownloadUrl
EditTime
Size
index.js
2018-01-03 03:16:15
320 B
license
2017-06-02 03:17:35
1.08 KB
package.json
2018-01-03 03:21:47
710 B
readme.md
2018-01-03 03:17:59
986 B
# has-flag [](https://travis-ci.org/sindresorhus/has-flag) > Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag Correctly stops looking after an `--` argument terminator. ## Install ``` $ npm install has-flag ``` ## Usage ```js // 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](https://sindresorhus.com)
2025-09-02 06:33:45 Tuesday 216.73.216.107 Runningtime:0.012s Mem:1.48 MB