Skip to content

Commit 9ba9ea4

Browse files
Jarred-Sumnerpaperclover
authored andcommitted
* Fixes oven-sh#5465 Fixes oven-sh#5465 * Update tty.js * Update InternalModuleRegistryConstants.h --------- Co-authored-by: Jarred Sumner <[email protected]>
1 parent 8d625bc commit 9ba9ea4

File tree

3 files changed

+33
-10
lines changed

3 files changed

+33
-10
lines changed

src/js/node/tty.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -216,14 +216,12 @@ Object.defineProperty(WriteStream, "prototype", {
216216
}
217217

218218
if ("TEAMCITY_VERSION" in env) {
219-
return RegExpPrototypeExec(/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/, env.TEAMCITY_VERSION) !== null
220-
? COLORS_16
221-
: COLORS_2;
219+
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? COLORS_16 : COLORS_2;
222220
}
223221

224222
switch (env.TERM_PROGRAM) {
225223
case "iTerm.app":
226-
if (!env.TERM_PROGRAM_VERSION || RegExpPrototypeExec(/^[0-2]\./, env.TERM_PROGRAM_VERSION) !== null) {
224+
if (!env.TERM_PROGRAM_VERSION || /^[0-2]\./.test(env.TERM_PROGRAM_VERSION)) {
227225
return COLORS_256;
228226
}
229227
return COLORS_16m;
@@ -239,16 +237,16 @@ Object.defineProperty(WriteStream, "prototype", {
239237
}
240238

241239
if (env.TERM) {
242-
if (RegExpPrototypeExec(/^xterm-256/, env.TERM) !== null) {
240+
if (/^xterm-256/.test(env.TERM) !== null) {
243241
return COLORS_256;
244242
}
245243

246-
const termEnv = StringPrototypeToLowerCase(env.TERM);
244+
const termEnv = env.TERM.toLowerCase();
247245

248246
if (TERM_ENVS[termEnv]) {
249247
return TERM_ENVS[termEnv];
250248
}
251-
if (ArrayPrototypeSome(TERM_ENVS_REG_EXP, term => RegExpPrototypeExec(term, termEnv) !== null)) {
249+
if (TERM_ENVS_REG_EXP.some(term => term.test(termEnv))) {
252250
return COLORS_16;
253251
}
254252
}

0 commit comments

Comments
 (0)