Skip to content

Commit

Permalink
refactor: replace custom clone method by Object.assign()
Browse files Browse the repository at this point in the history
  • Loading branch information
darrachequesne committed Apr 17, 2022
1 parent 71cd3ba commit bc3cefb
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions lib/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ export class Socket extends Emitter<{}, {}, SocketReservedEvents> {
*/
private createTransport(name) {
debug('creating transport "%s"', name);
const query: any = clone(this.opts.query);
const query: any = Object.assign({}, this.opts.query);

// append engine.io protocol identifier
query.EIO = protocol;
Expand Down Expand Up @@ -949,13 +949,3 @@ export class Socket extends Emitter<{}, {}, SocketReservedEvents> {
return filteredUpgrades;
}
}

function clone(obj) {
const o = {};
for (let i in obj) {
if (obj.hasOwnProperty(i)) {
o[i] = obj[i];
}
}
return o;
}

0 comments on commit bc3cefb

Please sign in to comment.