|
5 | 5 | // thread and the worker threads.
|
6 | 6 |
|
7 | 7 | const {
|
| 8 | + ArrayPrototypeEvery, |
8 | 9 | ArrayPrototypeMap,
|
9 | 10 | ArrayPrototypePush,
|
10 | 11 | ArrayPrototypeSplice,
|
@@ -258,27 +259,24 @@ function buildAllowedFlags() {
|
258 | 259 | const { options, aliases } = require('internal/options');
|
259 | 260 |
|
260 | 261 | const allowedNodeEnvironmentFlags = [];
|
261 |
| - for (const [name, info] of options) { |
| 262 | + for (const { 0: name, 1: info } of options) { |
262 | 263 | if (info.envVarSettings === kAllowedInEnvironment) {
|
263 | 264 | ArrayPrototypePush(allowedNodeEnvironmentFlags, name);
|
264 | 265 | }
|
265 | 266 | }
|
266 | 267 |
|
267 |
| - for (const [ from, expansion ] of aliases) { |
268 |
| - let isAccepted = true; |
269 |
| - for (const to of expansion) { |
270 |
| - if (!StringPrototypeStartsWith(to, '-') || to === '--') continue; |
271 |
| - const recursiveExpansion = aliases.get(to); |
272 |
| - if (recursiveExpansion) { |
273 |
| - if (recursiveExpansion[0] === to) |
274 |
| - ArrayPrototypeSplice(recursiveExpansion, 0, 1); |
275 |
| - ArrayPrototypePush(expansion, ...recursiveExpansion); |
276 |
| - continue; |
277 |
| - } |
278 |
| - isAccepted = options.get(to).envVarSettings === kAllowedInEnvironment; |
279 |
| - if (!isAccepted) break; |
| 268 | + function isAccepted(to) { |
| 269 | + if (!StringPrototypeStartsWith(to, '-') || to === '--') return true; |
| 270 | + const recursiveExpansion = aliases.get(to); |
| 271 | + if (recursiveExpansion) { |
| 272 | + if (recursiveExpansion[0] === to) |
| 273 | + ArrayPrototypeSplice(recursiveExpansion, 0, 1); |
| 274 | + return ArrayPrototypeEvery(recursiveExpansion, isAccepted); |
280 | 275 | }
|
281 |
| - if (isAccepted) { |
| 276 | + return options.get(to).envVarSettings === kAllowedInEnvironment; |
| 277 | + } |
| 278 | + for (const { 0: from, 1: expansion } of aliases) { |
| 279 | + if (ArrayPrototypeEvery(expansion, isAccepted)) { |
282 | 280 | let canonical = from;
|
283 | 281 | if (StringPrototypeEndsWith(canonical, '='))
|
284 | 282 | canonical = StringPrototypeSlice(canonical, 0, canonical.length - 1);
|
|
0 commit comments