Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion underscore.js
Original file line number Diff line number Diff line change
Expand Up @@ -1297,11 +1297,12 @@
return eq(a, b);
};

// Is a given array, string, or object empty?
// Is a given array, string, set, map or object empty?
// An "empty" object has no enumerable own-properties.
_.isEmpty = function(obj) {
if (obj == null) return true;
if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;
if (toString.call(obj) == '[object Map]' || toString.call(obj) == '[object Set]') return !obj.size
return _.keys(obj).length === 0;
};

Expand Down