size
Return the number of items in the collection.
.size(target)
Returns the number of items contained in target
. Target can
provide the size using the can.size symbol.
If the target
has a numeric length
property that is greater than or equal to 0, that
length
will be returned.
canReflect.size([1,2,3]) //-> 3
If the target
is isListLike, the values of the list will be counted.
If the target
is a plain JS object, the number of enumerable properties will be returned.
canReflect.size({foo:"bar"}) //-> 1
If the target
is anything else, undefined
is returned.
Parameters
- target
{Object}
:The container object.
Returns
{Number}
:
The number of values in the target.