setup-php/node_modules/has-flag/index.js
Shivam Mathur 8f9786b73f init
2019-09-06 05:17:43 +05:30

9 lines
320 B
JavaScript

'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);
};