@autofleet/rabbit 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ class RabbitMq {
82
82
  return channel.addSetup((c) => c.assertQueue(queue));
83
83
  }
84
84
  async consume(queue, callback, options) {
85
- const { limit } = options ? options : 1;
85
+ const { limit } = (options && options.limit) ? options : { limit: 1 };
86
86
  const channel = await this.assertChannel();
87
87
  await this.assertQueue(queue);
88
88
  return channel.addSetup(async (c) => {
@@ -93,7 +93,7 @@ class RabbitMq {
93
93
  });
94
94
  }
95
95
  async consumeFromExchange(queue, exchange, callback, options) {
96
- const { limit } = options ? options : 1;
96
+ const { limit } = (options && options.limit) ? options : { limit: 1 };
97
97
  const channel = await this.assertChannel();
98
98
  await Promise.all([
99
99
  this.assertExchange(exchange),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/rabbit",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
package/src/index.ts CHANGED
@@ -99,7 +99,7 @@ class RabbitMq {
99
99
  }
100
100
 
101
101
  async consume(queue: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any) {
102
- const { limit } = options ? options : 1;
102
+ const { limit } = (options && options.limit) ? options : { limit: 1 };
103
103
  const channel: ChannelWrapper = await this.assertChannel();
104
104
  await this.assertQueue(queue);
105
105
  return channel.addSetup(async (c: ConfirmChannel) => {
@@ -111,7 +111,7 @@ class RabbitMq {
111
111
  }
112
112
 
113
113
  async consumeFromExchange(queue: string, exchange: string, callback: (msg: any, ack: Function, nack: Function) => any, options?: any) {
114
- const { limit } = options ? options : 1;
114
+ const { limit } = (options && options.limit) ? options : { limit: 1 };
115
115
  const channel: ChannelWrapper = await this.assertChannel();
116
116
  await Promise.all([
117
117
  this.assertExchange(exchange),