mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
tty: refactor to avoid unsafe array iteration
PR-URL: https://github.com/nodejs/node/pull/36771 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Pooja D P <Pooja.D.P@ibm.com>
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
ArrayPrototypeSome,
|
||||
RegExpPrototypeTest,
|
||||
StringPrototypeSplit,
|
||||
StringPrototypeToLowerCase,
|
||||
@@ -202,10 +203,9 @@ function getColorDepth(env = process.env) {
|
||||
if (TERM_ENVS[termEnv]) {
|
||||
return TERM_ENVS[termEnv];
|
||||
}
|
||||
for (const term of TERM_ENVS_REG_EXP) {
|
||||
if (RegExpPrototypeTest(term, termEnv)) {
|
||||
return COLORS_16;
|
||||
}
|
||||
if (ArrayPrototypeSome(TERM_ENVS_REG_EXP,
|
||||
(term) => RegExpPrototypeTest(term, termEnv))) {
|
||||
return COLORS_16;
|
||||
}
|
||||
}
|
||||
// Move 16 color COLORTERM below 16m and 256
|
||||
|
||||
@@ -132,7 +132,7 @@ WriteStream.prototype._refreshSize = function() {
|
||||
this.emit('error', errors.errnoException(err, 'getWindowSize'));
|
||||
return;
|
||||
}
|
||||
const [newCols, newRows] = winSize;
|
||||
const { 0: newCols, 1: newRows } = winSize;
|
||||
if (oldCols !== newCols || oldRows !== newRows) {
|
||||
this.columns = newCols;
|
||||
this.rows = newRows;
|
||||
|
||||
Reference in New Issue
Block a user