Skip to content

Commit e875f30

Browse files
committed
Change argument order for add/remove match exist check
Attempts to correct logic to intended behaviour. That is, check existing property `match` on `this._matchRules` instead of `this._matchRules` on `match`.
1 parent 6b8f447 commit e875f30

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/bus.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ class MessageBus extends EventEmitter {
483483
}
484484

485485
_addMatch (match) {
486-
if (Object.prototype.hasOwnProperty.call(match, this._matchRules)) {
486+
if (Object.prototype.hasOwnProperty.call(this._matchRules, match)) {
487487
this._matchRules[match] += 1;
488488
return Promise.resolve();
489489
}
@@ -507,7 +507,7 @@ class MessageBus extends EventEmitter {
507507
return Promise.resolve();
508508
}
509509

510-
if (Object.prototype.hasOwnProperty.call(match, this._matchRules)) {
510+
if (Object.prototype.hasOwnProperty.call(this._matchRules, match)) {
511511
this._matchRules[match] -= 1;
512512
if (this._matchRules[match] > 0) {
513513
return Promise.resolve();

0 commit comments

Comments
 (0)