Skip to content

Commit c3f38cd

Browse files
authored
Use JS spread operator over Object.assign. NFC (#23759)
This saves a little bit of code size.
1 parent 9d0425f commit c3f38cd

File tree

80 files changed

+82
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+82
-82
lines changed

src/lib/libglfw.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var LibraryGLFW = {
5353
this.title = title;
5454
this.monitor = monitor;
5555
this.share = share;
56-
this.attributes = Object.assign({}, GLFW.hints);
56+
this.attributes = {...GLFW.hints};
5757
this.inputModes = {
5858
0x00033001:0x00034001, // GLFW_CURSOR (GLFW_CURSOR_NORMAL)
5959
0x00033002:0, // GLFW_STICKY_KEYS
@@ -1064,7 +1064,7 @@ var LibraryGLFW = {
10641064
},
10651065

10661066
defaultWindowHints: () => {
1067-
GLFW.hints = Object.assign({}, GLFW.defaultHints);
1067+
GLFW.hints = {...GLFW.defaultHints};
10681068
},
10691069

10701070
createWindow: (width, height, title, monitor, share) => {

src/lib/libidbfs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ addToLibrary({
5959
if (mount?.opts?.autoPersist) {
6060
mnt.idbPersistState = 0; // IndexedDB sync starts in idle state
6161
var memfs_node_ops = mnt.node_ops;
62-
mnt.node_ops = Object.assign({}, mnt.node_ops); // Clone node_ops to inject write tracking
62+
mnt.node_ops = {...mnt.node_ops}; // Clone node_ops to inject write tracking
6363
mnt.node_ops.mknod = (parent, name, mode, dev) => {
6464
var node = memfs_node_ops.mknod(parent, name, mode, dev);
6565
// Propagate injected node_ops to the newly created child node
@@ -69,7 +69,7 @@ addToLibrary({
6969
// Remember original MEMFS stream_ops for this node
7070
node.memfs_stream_ops = node.stream_ops;
7171
// Clone stream_ops to inject write tracking
72-
node.stream_ops = Object.assign({}, node.stream_ops);
72+
node.stream_ops = {...node.stream_ops};
7373

7474
// Track all file writes
7575
node.stream_ops.write = (stream, buffer, offset, length, position, canOwn) => {

src/lib/libnoderawfs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ addToLibrary({
2424
};
2525
// Use this to reference our in-memory filesystem
2626
/** @suppress {partialAlias} */
27-
var VFS = Object.assign({}, FS);
27+
var VFS = {...FS};
2828
// Wrap the whole in-memory filesystem API with
2929
// our Node.js based functions
3030
for (var _key in NODERAWFS) {

src/shell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ var ENVIRONMENT_IS_WASM_WORKER = !!Module['$ww'];
134134
// we collect those properties and reapply _after_ we configure
135135
// the current environment's defaults to avoid having to be so
136136
// defensive during initialization.
137-
var moduleOverrides = Object.assign({}, Module);
137+
var moduleOverrides = {...Module};
138138

139139
var arguments_ = [];
140140
var thisProgram = './this.program';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4150
1+
4137
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8263
1+
8262
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20087
1+
20074
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20065
1+
20052
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
23854
1+
23841
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8207
1+
8206

0 commit comments

Comments
 (0)