source: imaps-frontend/node_modules/has-flag/index.d.ts@ 0c6b92a

main
Last change on this file since 0c6b92a was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 684 bytes
Line 
1/**
2Check if [`argv`](https://nodejs.org/docs/latest/api/process.html#process_process_argv) has a specific flag.
3
4@param flag - CLI flag to look for. The `--` prefix is optional.
5@param argv - CLI arguments. Default: `process.argv`.
6@returns Whether the flag exists.
7
8@example
9```
10// $ ts-node foo.ts -f --unicorn --foo=bar -- --rainbow
11
12// foo.ts
13import hasFlag = require('has-flag');
14
15hasFlag('unicorn');
16//=> true
17
18hasFlag('--unicorn');
19//=> true
20
21hasFlag('f');
22//=> true
23
24hasFlag('-f');
25//=> true
26
27hasFlag('foo=bar');
28//=> true
29
30hasFlag('foo');
31//=> false
32
33hasFlag('rainbow');
34//=> false
35```
36*/
37declare function hasFlag(flag: string, argv?: string[]): boolean;
38
39export = hasFlag;
Note: See TracBrowser for help on using the repository browser.