mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 00:27:50 +00:00
improve #isEmpty implementation. add 2 tests
This commit is contained in:
@@ -503,7 +503,9 @@
|
||||
|
||||
// Is a given array or object empty?
|
||||
_.isEmpty = function(obj) {
|
||||
return _.keys(obj).length == 0;
|
||||
if (_.isArray(obj)) return obj.length===0;
|
||||
for (var k in obj) return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
// Is a given value a DOM element?
|
||||
|
||||
Reference in New Issue
Block a user