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 — timers: refactor to use optional chaining · nodejs/node@d8f535b

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • timers.js
    • timers
      • promises.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/timers.js‎

Copy file name to clipboardExpand all lines: lib/timers.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ ObjectDefineProperty(setTimeout, customPromisify, {
171171
});
172172

173173
function clearTimeout(timer) {
174-
if (timer && timer._onTimeout) {
174+
if (timer?._onTimeout) {
175175
timer._onTimeout = null;
176176
unenroll(timer);
177177
return;
Collapse file

‎lib/timers/promises.js‎

Copy file name to clipboardExpand all lines: lib/timers/promises.js
+2-8Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,7 @@ function setTimeout(after, value, options = {}) {
4949
'boolean',
5050
ref));
5151
}
52-
// TODO(@jasnell): If a decision is made that this cannot be backported
53-
// to 12.x, then this can be converted to use optional chaining to
54-
// simplify the check.
55-
if (signal && signal.aborted) {
52+
if (signal?.aborted) {
5653
return PromiseReject(new AbortError());
5754
}
5855
let oncancel;
@@ -94,10 +91,7 @@ function setImmediate(value, options = {}) {
9491
'boolean',
9592
ref));
9693
}
97-
// TODO(@jasnell): If a decision is made that this cannot be backported
98-
// to 12.x, then this can be converted to use optional chaining to
99-
// simplify the check.
100-
if (signal && signal.aborted) {
94+
if (signal?.aborted) {
10195
return PromiseReject(new AbortError());
10296
}
10397
let oncancel;

0 commit comments

Comments
0 (0)
You are visitor 01402520 — 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.