Skip to content

Commit 46a930d

Browse files
authored
Fix params mutating by ref in constructors (#13)
* fix params mutating by ref in constructors * v2.0.1
1 parent 6ad44f8 commit 46a930d

File tree

5 files changed

+10
-9
lines changed

5 files changed

+10
-9
lines changed

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@elastic.io/amqp-rpc",
33
"description": "RPC over RabbitMQ for Node.js",
4-
"version": "2.0.0",
4+
"version": "2.0.1",
55
"homepage": "http://elastic.io",
66
"author": "elastic.io GmbH <[email protected]>",
77
"main": "src/index.js",

src/AMQPEndpoint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class AMQPEndpoint {
1515
constructor(connection, params = {}) {
1616
this._connection = connection;
1717
this._channel = null;
18-
this._params = params;
18+
this._params = Object.assign({}, params);
1919
}
2020

2121
/**

src/AMQPEventsReceiver.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ class AMQPEventsReceiver extends EventEmitter {
2929

3030
this._connection = amqpConnection;
3131

32-
this._params = params;
33-
params.queueName = params.queueName || '';
34-
params.TTL = params.TTL || AMQPEventsReceiver.TTL;
35-
this._queueName = params.queueName;
32+
this._params = Object.assign({
33+
queueName: ''
34+
}, params);
35+
this._queueName = this._params.queueName;
3636

3737
this._channel = null;
3838
}

src/AMQPEventsSender.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@ class AMQPEventsSender extends EventEmitter {
2626
super();
2727
this._connection = amqpConnection;
2828

29-
this._params = params;
30-
params.TTL = params.TTL || AMQPEventsSender.TTL;
29+
this._params = Object.assign({
30+
TTL: AMQPEventsSender.TTL
31+
}, params);
3132
this._queueName = params.queueName;
3233

3334
this._channel = null;

0 commit comments

Comments
 (0)