mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 17:07:49 +00:00
Remove semicolons.
This commit is contained in:
32
size.js
32
size.js
@@ -1,12 +1,12 @@
|
||||
import baseKeys from './.internal/baseKeys.js';
|
||||
import getTag from './.internal/getTag.js';
|
||||
import isArrayLike from './isArrayLike.js';
|
||||
import isString from './isString.js';
|
||||
import stringSize from './.internal/stringSize.js';
|
||||
import baseKeys from './.internal/baseKeys.js'
|
||||
import getTag from './.internal/getTag.js'
|
||||
import isArrayLike from './isArrayLike.js'
|
||||
import isString from './isString.js'
|
||||
import stringSize from './.internal/stringSize.js'
|
||||
|
||||
/** `Object#toString` result references. */
|
||||
const mapTag = '[object Map]';
|
||||
const setTag = '[object Set]';
|
||||
const mapTag = '[object Map]'
|
||||
const setTag = '[object Set]'
|
||||
|
||||
/**
|
||||
* Gets the size of `collection` by returning its length for array-like
|
||||
@@ -18,27 +18,27 @@ const setTag = '[object Set]';
|
||||
* @returns {number} Returns the collection size.
|
||||
* @example
|
||||
*
|
||||
* size([1, 2, 3]);
|
||||
* size([1, 2, 3])
|
||||
* // => 3
|
||||
*
|
||||
* size({ 'a': 1, 'b': 2 });
|
||||
* size({ 'a': 1, 'b': 2 })
|
||||
* // => 2
|
||||
*
|
||||
* size('pebbles');
|
||||
* size('pebbles')
|
||||
* // => 7
|
||||
*/
|
||||
function size(collection) {
|
||||
if (collection == null) {
|
||||
return 0;
|
||||
return 0
|
||||
}
|
||||
if (isArrayLike(collection)) {
|
||||
return isString(collection) ? stringSize(collection) : collection.length;
|
||||
return isString(collection) ? stringSize(collection) : collection.length
|
||||
}
|
||||
const tag = getTag(collection);
|
||||
const tag = getTag(collection)
|
||||
if (tag == mapTag || tag == setTag) {
|
||||
return collection.size;
|
||||
return collection.size
|
||||
}
|
||||
return baseKeys(collection).length;
|
||||
return baseKeys(collection).length
|
||||
}
|
||||
|
||||
export default size;
|
||||
export default size
|
||||
|
||||
Reference in New Issue
Block a user