mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
size enhancement as ternary and _.size(arr) test case
This commit is contained in:
@@ -309,11 +309,7 @@
|
||||
|
||||
// Return the number of elements in an object.
|
||||
_.size = function(obj) {
|
||||
if (_.isArray(obj)) {
|
||||
return obj.length;
|
||||
}else{
|
||||
return _.keys(obj).length;
|
||||
}
|
||||
return _.isArray(obj) ? obj.length : _.keys(obj).length;
|
||||
};
|
||||
|
||||
// Array Functions
|
||||
|
||||
Reference in New Issue
Block a user