index.js
function hasListeners (emitter, type) {
  var count = typeof emitter.listenerCount !== 'function'
    ? emitter.listeners(type).length
    : emitter.listenerCount(type)

  return count > 0
}
function hasListeners (emitter, type) {
  var count = typeof emitter.listenerCount !== 'function'
    ? emitter.listeners(type).length
    : emitter.listenerCount(type)

  return count > 0
}
function hasListeners ( emitter , type ) { var count = typeof emitter . listenerCount !== 'function' ? emitter . listeners ( type ) . length : emitter . listenerCount ( type ) return count > 0 }
Determine if emitter has listeners of a given type.

The way to do this check is done three different ways in Node.js >= 0.8
so this consolidates them into a minimal set using instance methods.

@param {EventEmitter} emitter
@param {string} type
@returns {boolean}
@private
Determine if emitter has listeners of a given type .