* Replace underscores with dashes in the v8Flag name * Also ensure that if the arg contains a value (e.g. --arg=true) * that only the flag is returned.
(arg: string)
| 18 | * that only the flag is returned. |
| 19 | */ |
| 20 | function getNormalizedV8Flag(arg: string) { |
| 21 | // v8 uses the "no" prefix to negate boolean flags (e.g. --nolazy), |
| 22 | // but they are not listed by v8flags |
| 23 | const matches = /--(?:no)?(.+)/.exec(arg); |
| 24 | |
| 25 | if (matches) { |
| 26 | return `--${matches[1].replace(/_/g, "-")}`; |
| 27 | } |
| 28 | |
| 29 | return arg; |
| 30 | } |
| 31 | |
| 32 | return new Promise((resolve, reject) => { |
| 33 | getV8FlagsRaw((err: Error, flags: string[]) => { |