mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-09 10:27:49 +00:00
Add support for maps and sets to _.size.
This commit is contained in:
@@ -8572,6 +8572,12 @@
|
||||
var result = collection.length;
|
||||
return (result && isString(collection)) ? stringSize(collection) : result;
|
||||
}
|
||||
if (isObjectLike(collection)) {
|
||||
var tag = getTag(collection);
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return collection.size;
|
||||
}
|
||||
}
|
||||
return keys(collection).length;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user