mirror of
https://github.com/flynx/colors.js.git
synced 2025-10-29 11:00:11 +00:00
Update has-flag.js
This commit is contained in:
parent
007f4d1cd5
commit
fdd9b55cd1
@ -13,8 +13,9 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
|
||||
'use strict';
|
||||
module.exports = function (flag, argv) {
|
||||
argv = argv || process.argv;
|
||||
|
||||
var terminatorPos = argv.indexOf('--');
|
||||
var prefix = /^-{1,2}/.test(flag) ? '' : '--';
|
||||
var prefix = /^-{1,2}/.test(flag) ? '' : '--';
|
||||
var pos = argv.indexOf(prefix + flag);
|
||||
|
||||
return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user