* Gets the size of `collection` by returning its length for array-like * values or the number of own enumerable properties for objects. * * @static * @memberOf _ * @category Collection * @param {Array|Object|string} collection The collection to inspect. * @returns
(collection)
| 8482 | * // => 7 |
| 8483 | */ |
| 8484 | function size(collection) { |
| 8485 | var length = collection ? getLength(collection) : 0; |
| 8486 | return isLength(length) ? length : keys(collection).length; |
| 8487 | } |
| 8488 | |
| 8489 | /** |
| 8490 | * Checks if `predicate` returns truthy for **any** element of `collection`. |