has-flag

WebJar for has-flag

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

has-flag
Last Version

Last Version

4.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

has-flag
WebJar for has-flag
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/has-flag

Download has-flag

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/has-flag/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>has-flag</artifactId>
    <version>4.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/has-flag/
implementation 'org.webjars.npm:has-flag:4.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/has-flag/
implementation ("org.webjars.npm:has-flag:4.0.0")
'org.webjars.npm:has-flag:jar:4.0.0'
<dependency org="org.webjars.npm" name="has-flag" rev="4.0.0">
  <artifact name="has-flag" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='has-flag', version='4.0.0')
)
libraryDependencies += "org.webjars.npm" % "has-flag" % "4.0.0"
[org.webjars.npm/has-flag "4.0.0"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

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.


Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Version
4.0.0
3.0.0
2.0.0
1.0.0