Skip to content

Commit 7d8c0ac

Browse files
committed
lib,tools: use object spread instead of Object.assign() where possible
1 parent 8ab37dc commit 7d8c0ac

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

lib/session.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Session extends Map {
3737
// for Session objects when exporting the Session objects.
3838
//
3939
toString() {
40-
const copy = Object.assign({}, this);
40+
const copy = { ...this };
4141
copy.storage = Array.from(this);
4242
function replacer(key, value) {
4343
switch (key) {

lib/ws-internal.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,13 @@ const allowAllOriginCheckStrategy = function(/* origin */) {
8585
};
8686

8787
const initServer = function(options, httpServer) {
88-
options = Object.assign({}, options, {
88+
options = {
89+
...options,
8990
httpServer,
9091
autoAcceptConnections: false,
9192
maxReceivedFrameSize: constants.MAX_MESSAGE_SIZE,
9293
maxReceivedMessageSize: constants.MAX_MESSAGE_SIZE,
93-
});
94+
};
9495

9596
httpServer.isOriginAllowed =
9697
options.originCheckStrategy || allowAllOriginCheckStrategy;

tools/prepare-release.js

+4-6
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,10 @@ function getSemverTag(repo, id) {
137137
}
138138

139139
function httpsGetJson(options) {
140-
options = Object.assign(
141-
{
142-
headers: { 'User-Agent': 'metarhia-jstp-release-tool' },
143-
},
144-
options
145-
);
140+
options = {
141+
headers: { 'User-Agent': 'metarhia-jstp-release-tool' },
142+
...options,
143+
};
146144
if (token) {
147145
options.headers['Authorization'] = `token ${token}`;
148146
}

0 commit comments

Comments
 (0)