diff options
author | Trevor Norris <trev.norris@gmail.com> | 2013-03-04 11:59:55 -0800 |
---|---|---|
committer | Trevor Norris <trev.norris@gmail.com> | 2013-03-04 11:59:55 -0800 |
commit | d09ab61dcd4943ec543417df12487a2c8510cc1e (patch) | |
tree | 61400b7464923fdabfac14458c5bb69742b51c0a /lib | |
parent | 04688614f70470dba1f7512844fd2c4008d9d8bd (diff) | |
download | android-node-v8-d09ab61dcd4943ec543417df12487a2c8510cc1e.tar.gz android-node-v8-d09ab61dcd4943ec543417df12487a2c8510cc1e.tar.bz2 android-node-v8-d09ab61dcd4943ec543417df12487a2c8510cc1e.zip |
events: code consistency
v8 likes when smaller functions have a single return point, and cleaned
up the single non-strict check.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/events.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/events.js b/lib/events.js index 9eaa36ba68..bee1c6132f 100644 --- a/lib/events.js +++ b/lib/events.js @@ -84,7 +84,7 @@ EventEmitter.prototype.emit = function(type) { if (this.domain && this !== process) this.domain.enter(); - if (typeof handler == 'function') { + if (typeof handler === 'function') { switch (arguments.length) { // fast cases case 1: @@ -267,11 +267,14 @@ EventEmitter.prototype.removeAllListeners = function(type) { }; EventEmitter.prototype.listeners = function(type) { + var ret; if (!this._events || !this._events[type]) - return []; - if (typeof this._events[type] === 'function') - return [this._events[type]]; - return this._events[type].slice(); + ret = []; + else if (typeof this._events[type] === 'function') + ret = [this._events[type]]; + else + ret = this._events[type].slice(); + return ret; }; EventEmitter.listenerCount = function(emitter, type) { |