Skip to content

Commit

Permalink
Lax array check.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanve committed May 3, 2014
1 parent 35e821c commit 2bc7d93
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@
, array = []
, slice = array.slice
, owns = proceed.hasOwnProperty
, toString = proceed.toString
, events = '_events'
, origin = '_origin'
, emit = 'emit'
, mode = 'mode'
, init = 'init'
, listeners = 'listeners'
, isArray = Array.isArray || function(o) {
return toString.call(array) === toString.call(o);
, ifArray = function(o) {
return o instanceof Array && o;
};

emitter[mode] = {'max': 0, 'all':false};
Expand Down Expand Up @@ -119,7 +118,7 @@
* @return {Array}
*/
emitter[listeners] = function(id) {
return isArray(this[events][id]) ? this[events][id] : this[events][id] = [];
return this[events][id] = ifArray(this[events][id]) || [];
};

/**
Expand Down

0 comments on commit 2bc7d93

Please sign in to comment.