Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/has-flag/index.js')
-rw-r--r--node_modules/has-flag/index.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/node_modules/has-flag/index.js b/node_modules/has-flag/index.js
index 5139728fb..b6f80b1f8 100644
--- a/node_modules/has-flag/index.js
+++ b/node_modules/has-flag/index.js
@@ -1,8 +1,8 @@
'use strict';
-module.exports = (flag, argv) => {
- argv = argv || process.argv;
+
+module.exports = (flag, argv = process.argv) => {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
- const pos = argv.indexOf(prefix + flag);
- const terminatorPos = argv.indexOf('--');
- return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
+ const position = argv.indexOf(prefix + flag);
+ const terminatorPosition = argv.indexOf('--');
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
};