Pibd-21_Ievlewa_M.D._Intern.../node_modules/has-flag
2023-12-21 23:41:43 +03:00
..
index.d.ts Лабораторная 2 2023-12-03 18:52:09 +03:00
index.js lab4+отчет 2023-12-21 23:41:43 +03:00
license Лабораторная 2 2023-12-03 18:52:09 +03:00
package.json lab4+отчет 2023-12-21 23:41:43 +03:00
readme.md lab4+отчет 2023-12-21 23:41:43 +03:00

has-flag Build Status

Check if argv has 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