From 77d36062d062d5f8e8c56e957045ea66ef354c52 Mon Sep 17 00:00:00 2001 From: WubTheCaptain Date: Sun, 20 Sep 2015 13:16:51 +0000 Subject: Simplify multiple ifs to one if with OR condition --- js/cheesesteak.js | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'js/cheesesteak.js') 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; } -- cgit v1.2.3