Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit fecad7a

Browse filesBrowse files
LiviaMedeirosdanielleadams
authored andcommitted
timers: use kEmptyObject
PR-URL: #43159 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent e576a7f commit fecad7a
Copy full SHA for fecad7a

File tree

Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-3
lines changed
Open diff view settings
Collapse file

‎lib/timers/promises.js‎

Copy file name to clipboardExpand all lines: lib/timers/promises.js
+7-3Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ const {
3535
validateObject,
3636
} = require('internal/validators');
3737

38+
const {
39+
kEmptyObject,
40+
} = require('internal/util');
41+
3842
const kScheduler = Symbol('kScheduler');
3943

4044
function cancelListenerHandler(clear, reject, signal) {
@@ -44,7 +48,7 @@ function cancelListenerHandler(clear, reject, signal) {
4448
}
4549
}
4650

47-
function setTimeout(after, value, options = {}) {
51+
function setTimeout(after, value, options = kEmptyObject) {
4852
const args = value !== undefined ? [value] : value;
4953
if (options == null || typeof options !== 'object') {
5054
return PromiseReject(
@@ -88,7 +92,7 @@ function setTimeout(after, value, options = {}) {
8892
() => signal.removeEventListener('abort', oncancel)) : ret;
8993
}
9094

91-
function setImmediate(value, options = {}) {
95+
function setImmediate(value, options = kEmptyObject) {
9296
if (options == null || typeof options !== 'object') {
9397
return PromiseReject(
9498
new ERR_INVALID_ARG_TYPE(
@@ -132,7 +136,7 @@ function setImmediate(value, options = {}) {
132136
() => signal.removeEventListener('abort', oncancel)) : ret;
133137
}
134138

135-
async function* setInterval(after, value, options = {}) {
139+
async function* setInterval(after, value, options = kEmptyObject) {
136140
validateObject(options, 'options');
137141
const { signal, ref = true } = options;
138142
validateAbortSignal(signal, 'options.signal');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.