4.17.11
3.10.1
2.4.2
1.3.1

_.size(collection)

Gets the size of collection by returning its length for array-like values or the number of own enumerable string keyed properties for objects.

Since

0.1.0

Arguments

argument
collection
type
(Array|Object|string)
description
The collection to inspect.

Returns

(array)

Example

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

_.size({ a: 1, b: 2 });
// => 2

_.size("pebbles");
// => 7
_.size([1, 2, 3]);
// => 3

_.size({ a: 1, b: 2 });
// => 2

_.size("pebbles");
// => 7