MCPcopy Create free account
hub / github.com/babel/babel / getNormalizedV8Flag

Function getNormalizedV8Flag

packages/babel-node/src/babel-node.ts:20–30  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

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[]) => {

Callers 1

getV8FlagsFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected