12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- import baseKeys from './_baseKeys.js';
- import getTag from './_getTag.js';
- import isArrayLike from './isArrayLike.js';
- import isString from './isString.js';
- import stringSize from './_stringSize.js';
- var mapTag = '[object Map]',
- setTag = '[object Set]';
- function size(collection) {
- if (collection == null) {
- return 0;
- }
- if (isArrayLike(collection)) {
- return isString(collection) ? stringSize(collection) : collection.length;
- }
- var tag = getTag(collection);
- if (tag == mapTag || tag == setTag) {
- return collection.size;
- }
- return baseKeys(collection).length;
- }
- export default size;
|