summaryrefslogtreecommitdiff
path: root/node_modules/has-flag/index.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:20:49 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:20:49 +0800
commitc5a5384e846f242e901e859fe600d695d8990a9a (patch)
tree079d4ccf2ed93dc1f0cae74a6d3b4a42ac387ece /node_modules/has-flag/index.js
parentd261b7aafee0e6e5c7b853cb8dfe609cc0a0ac9e (diff)
legacy browser support via plugins from postcss
Diffstat (limited to 'node_modules/has-flag/index.js')
-rw-r--r--node_modules/has-flag/index.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/node_modules/has-flag/index.js b/node_modules/has-flag/index.js
new file mode 100644
index 00000000..5139728f
--- /dev/null
+++ b/node_modules/has-flag/index.js
@@ -0,0 +1,8 @@
+'use strict';
+module.exports = (flag, argv) => {
+ argv = 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);
+};