GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tty: refactor to avoid unsafe array iteration · nodejs/node@258aa50

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • internal
      • tty.js
    • tty.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/tty.js‎

Copy file name to clipboardExpand all lines: lib/internal/tty.js
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'use strict';
2424

2525
const {
26+
ArrayPrototypeSome,
2627
RegExpPrototypeTest,
2728
StringPrototypeSplit,
2829
StringPrototypeToLowerCase,
@@ -202,10 +203,9 @@ function getColorDepth(env = process.env) {
202203
if (TERM_ENVS[termEnv]) {
203204
return TERM_ENVS[termEnv];
204205
}
205-
for (const term of TERM_ENVS_REG_EXP) {
206-
if (RegExpPrototypeTest(term, termEnv)) {
207-
return COLORS_16;
208-
}
206+
if (ArrayPrototypeSome(TERM_ENVS_REG_EXP,
207+
(term) => RegExpPrototypeTest(term, termEnv))) {
208+
return COLORS_16;
209209
}
210210
}
211211
// Move 16 color COLORTERM below 16m and 256
Collapse file

‎lib/tty.js‎

Copy file name to clipboardExpand all lines: lib/tty.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ WriteStream.prototype._refreshSize = function() {
132132
this.emit('error', errors.errnoException(err, 'getWindowSize'));
133133
return;
134134
}
135-
const [newCols, newRows] = winSize;
135+
const { 0: newCols, 1: newRows } = winSize;
136136
if (oldCols !== newCols || oldRows !== newRows) {
137137
this.columns = newCols;
138138
this.rows = newRows;

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.