Skip to content

Commit 8b5c1e9

Browse files
committed
lib: use kEmptyObject in worker
1 parent d430a80 commit 8b5c1e9

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/internal/worker.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ const {
5555
} = workerIo;
5656
const { deserializeError } = require('internal/error_serdes');
5757
const { fileURLToPath, isURLInstance, pathToFileURL } = require('internal/url');
58+
const { kEmptyObject } = require('internal/util');
5859
const { validateArray } = require('internal/validators');
5960

6061
const {
@@ -118,7 +119,7 @@ function assignEnvironmentData(data) {
118119
}
119120

120121
class Worker extends EventEmitter {
121-
constructor(filename, options = {}) {
122+
constructor(filename, options = kEmptyObject) {
122123
super();
123124
debug(`[${threadId}] create new worker`, filename, options);
124125
if (options.execArgv)

lib/internal/worker/io.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ const {
1818
SymbolFor,
1919
} = primordials;
2020

21-
const { kEnumerableProperty } = require('internal/util');
21+
const {
22+
kEmptyObject,
23+
kEnumerableProperty,
24+
} = require('internal/util');
2225

2326
const {
2427
handle_onclose: handleOnCloseSymbol,
@@ -123,7 +126,7 @@ class MessageEvent extends Event {
123126
lastEventId = '',
124127
source = null,
125128
ports = [],
126-
} = {}) {
129+
} = kEmptyObject) {
127130
super(type);
128131
this[kData] = data;
129132
this[kOrigin] = `${origin}`;

0 commit comments

Comments
 (0)