collection.js
function size(collection) {
  var x, i = 0;

  if ('object' === type(collection)) {
    for (x in collection) i++;
    return i;
  }

  return +collection.length;
}
function size(collection) {
  var x, i = 0;

  if ('object' === type(collection)) {
    for (x in collection) i++;
    return i;
  }

  return +collection.length;
}
function size ( collection ) { var x , i = 0 ; if ( 'object' === type ( collection ) ) { for ( x in collection ) i ++ ; return i ; } return + collection . length ; }
Determine the size of a collection.

@param {Mixed} collection The object we want to know the size of.
@returns {Number} The size of the collection.
@api public
Determine the size of a collection .