diff options
| author | WubTheCaptain <wub@partyvan.eu> | 2015-09-20 15:16:51 +0200 |
|---|---|---|
| committer | WubTheCaptain <wub@partyvan.eu> | 2015-09-20 15:16:51 +0200 |
| commit | 77d36062d062d5f8e8c56e957045ea66ef354c52 (patch) | |
| tree | 799e6663edf9373247689bb21238081a500e6828 /js | |
| parent | 5cb355b078f1b74b3b85aa23a4476dffe58b6b8e (diff) | |
Simplify multiple ifs to one if with OR condition
Diffstat (limited to 'js')
| -rw-r--r-- | js/cheesesteak.js | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/js/cheesesteak.js b/js/cheesesteak.js index 1957aad..709d446 100644 --- a/js/cheesesteak.js +++ b/js/cheesesteak.js @@ -8,19 +8,13 @@ this._events[evt].push(fn); }; EventEmitter.prototype.off = function(evt, fn) { - if (!this.hasOwnProperty('_events')) { - return; - } - if (evt in this._events === false) { + if (!this.hasOwnProperty('_events') || evt in this._events === false) { return; } this._events[evt].splice(this._events[evt].indexOf(fn), 1); }; EventEmitter.prototype.emit = function(evt) { - if (!this.hasOwnProperty('_events')) { - return; - } - if (evt in this._events === false) { + if (!this.hasOwnProperty('_events') || evt in this._events === false) { return; } |
