libs/lodash.js
function size(collection) {
      var length = collection ? collection.length : 0;
      return (typeof length == 'number' && length > -1 && length <= maxSafeInteger)
        ? length
        : keys(collection).length;
    }
function size(collection) {
      var length = collection ? collection.length : 0;
      return (typeof length == 'number' && length > -1 && length <= maxSafeInteger)
        ? length
        : keys(collection).length;
    }
function size ( collection ) { var length = collection ? collection . length : 0 ; return ( typeof length == 'number' && length > - 1 && length <= maxSafeInteger ) ? length : keys ( collection ) . length ; }
Gets the size of the collection by returning `collection.length` for arrays
and array-like objects or the number of own enumerable properties for objects.

@static
@memberOf _
@category Collections
@param {Array|Object|string} collection The collection to inspect.
@returns {number} Returns `collection.length` or number of own enumerable properties.
@example

_.size([1, 2]);
// => 2

_.size({ 'one': 1, 'two': 2, 'three': 3 });
// => 3

_.size('pebbles');
// => 7
Gets the size of the collection by returning collection . length for arrays and array - like objects or the number of own enumerable properties for objects .