From 3a94acf27ea1eff8bd1125450f07c0c366332e80 Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 17 Oct 2021 20:08:04 +0200 Subject: Initial commit --- node_modules/has-flag/index.js | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 node_modules/has-flag/index.js (limited to 'node_modules/has-flag/index.js') diff --git a/node_modules/has-flag/index.js b/node_modules/has-flag/index.js new file mode 100644 index 0000000..5139728 --- /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); +}; -- cgit