Skip to content

Commit bf5fd13

Browse files
jiridanekkornys
authored andcommitted
Fix formatting of dict['priority'] === 0 (should remain 0, not 4) (#19)
Previously, `!dict['priority']` would be !0, which evaluates to true. Now, the condition is true only if `dict[priority]` is null or undefined.
1 parent ca95978 commit bf5fd13

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/formatter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ class Formatter {
143143
const workDict = {};
144144
//amqp header
145145
workDict['durable'] = dict['durable'];
146-
workDict['priority'] = !dict['priority'] ? 4 : dict['priority'];
146+
workDict['priority'] = dict['priority'] == null ? 4 : dict['priority'];
147147
workDict['ttl'] = dict['ttl'];
148148
workDict['first-acquirer'] = dict['first_acquirer'];
149149
workDict['delivery-count'] = dict['delivery_count'];
@@ -196,7 +196,7 @@ class Formatter {
196196
const workDict = {};
197197
//amqp header
198198
workDict['durable'] = dict['durable'];
199-
workDict['priority'] = !dict['priority'] ? 4 : dict['priority'];
199+
workDict['priority'] = dict['priority'] == null ? 4 : dict['priority'];
200200
workDict['ttl'] = dict['ttl'];
201201
workDict['first_acquirer'] = dict['first_acquirer'];
202202
workDict['delivery_count'] = dict['delivery_count'];

0 commit comments

Comments
 (0)