Files
glink-website/node_modules/has-flag/index.js
Aravind142857 a8b8883b11 Node JS version
2023-06-09 20:10:18 -05:00

9 lines
330 B
JavaScript

'use strict';
module.exports = (flag, argv = process.argv) => {
const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
const position = argv.indexOf(prefix + flag);
const terminatorPosition = argv.indexOf('--');
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
};