diff options
Diffstat (limited to 'node_modules/has-flag/index.js')
-rw-r--r-- | node_modules/has-flag/index.js | 10 |
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); }; |