blob: b6f80b1f8ffd7658a11af977a9df3c296008d4cd [file] [log] [blame]
Leo Repp58b9f112021-11-22 11:57:47 +01001'use strict';
2
3module.exports = (flag, argv = process.argv) => {
4 const prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');
5 const position = argv.indexOf(prefix + flag);
6 const terminatorPosition = argv.indexOf('--');
7 return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
8};