You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

has-flag

Package Overview
Dependencies
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 2.0.0

4

index.js

@@ -6,6 +6,6 @@ 'use strict';

var terminatorPos = argv.indexOf('--');
var prefix = /^--/.test(flag) ? '' : '--';
var prefix = /^-{1,2}/.test(flag) ? '' : '--';
var pos = argv.indexOf(prefix + flag);
return pos !== -1 && (terminatorPos !== -1 ? pos < terminatorPos : true);
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
};
{
"name": "has-flag",
"version": "1.0.0",
"version": "2.0.0",
"description": "Check if argv has a specific flag",

@@ -21,3 +21,3 @@ "license": "MIT",

"scripts": {
"test": "node test.js"
"test": "xo && ava"
},

@@ -47,4 +47,5 @@ "files": [

"devDependencies": {
"ava": "0.0.4"
"ava": "*",
"xo": "*"
}
}

@@ -19,3 +19,3 @@ # has-flag [![Build Status](https://travis-ci.org/sindresorhus/has-flag.svg?branch=master)](https://travis-ci.org/sindresorhus/has-flag)

// foo.js
var hasFlag = require('has-flag');
const hasFlag = require('has-flag');

@@ -28,2 +28,5 @@ hasFlag('unicorn');

hasFlag('-f');
//=> true
hasFlag('foo=bar');

@@ -40,3 +43,3 @@ //=> true

```
$ node foo.js --unicorn --foo=bar -- --rainbow
$ node foo.js -f --unicorn --foo=bar -- --rainbow
```

@@ -59,3 +62,3 @@

Type: `array`
Type: `array`<br>
Default: `process.argv`

@@ -68,2 +71,2 @@

MIT © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](https://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc