* Gets the size of `collection` by returning its length for array-like * values or the number of own enumerable string keyed properties for objects. * * @static * @memberOf _ * @since 0.1.0 * @category Collection * @param {Array|Object|s
(collection)
| 20467 | * // => 7 |
| 20468 | */ |
| 20469 | function size(collection) { |
| 20470 | if (collection == null) { |
| 20471 | return 0; |
| 20472 | } |
| 20473 | if (isArrayLike(collection)) { |
| 20474 | return isString(collection) ? stringSize(collection) : collection.length; |
| 20475 | } |
| 20476 | var tag = getTag(collection); |
| 20477 | if (tag == mapTag || tag == setTag) { |
| 20478 | return collection.size; |
| 20479 | } |
| 20480 | return baseKeys(collection).length; |
| 20481 | } |
| 20482 | |
| 20483 | /** |
| 20484 | * Checks if `predicate` returns truthy for **any** element of `collection`. |
nothing calls this directly
no test coverage detected