liusuyi
2024-08-08 46f7995983615272a31d09965a86d436e4a9ee4d
1
2
3
4
5
6
7
8
'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);
};