Skip to content

Commit fecad7a

Browse files
LiviaMedeirosdanielleadams
authored andcommitted
timers: use kEmptyObject
PR-URL: #43159 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent e576a7f commit fecad7a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/timers/promises.js

+7-3
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)