Returns true if object contains no values.
用于检测一个对象是否是空的
1 _.isEmpty([1, 2, 3]); 2 => false 3 _.isEmpty({}); 4 => true
源码:
1 _.isEmpty = function(obj) { 2 if (obj == null) return true; 3 if (_.isArray(obj) || _.isString(obj)) return obj.length === 0; 4 for (var key in obj) if (_.has(obj, key)) return false; 5 return true; 6 };