Blame view

node_modules/event-emitter/has-listeners.js 433 Bytes
ce4c83ff   wxy   初始提交
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  'use strict';
  
  var isEmpty = require('es5-ext/object/is-empty')
    , value   = require('es5-ext/object/valid-value')
  
    , hasOwnProperty = Object.prototype.hasOwnProperty;
  
  module.exports = function (obj/*, type*/) {
  	var type;
  	value(obj);
  	type = arguments[1];
  	if (arguments.length > 1) {
  		return hasOwnProperty.call(obj, '__ee__') && Boolean(obj.__ee__[type]);
  	}
  	return obj.hasOwnProperty('__ee__') && !isEmpty(obj.__ee__);
  };