mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 00:57:48 +00:00
Remove semicolons.
This commit is contained in:
42
isEmpty.js
42
isEmpty.js
@@ -1,13 +1,13 @@
|
||||
import baseKeys from './.internal/baseKeys.js';
|
||||
import getTag from './.internal/getTag.js';
|
||||
import isArguments from './isArguments.js';
|
||||
import isArrayLike from './isArrayLike.js';
|
||||
import isBuffer from './isBuffer.js';
|
||||
import isPrototype from './.internal/isPrototype.js';
|
||||
import isTypedArray from './isTypedArray.js';
|
||||
import baseKeys from './.internal/baseKeys.js'
|
||||
import getTag from './.internal/getTag.js'
|
||||
import isArguments from './isArguments.js'
|
||||
import isArrayLike from './isArrayLike.js'
|
||||
import isBuffer from './isBuffer.js'
|
||||
import isPrototype from './.internal/isPrototype.js'
|
||||
import isTypedArray from './isTypedArray.js'
|
||||
|
||||
/** Used to check objects for own properties. */
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
const hasOwnProperty = Object.prototype.hasOwnProperty
|
||||
|
||||
/**
|
||||
* Checks if `value` is an empty object, collection, map, or set.
|
||||
@@ -25,43 +25,43 @@ const hasOwnProperty = Object.prototype.hasOwnProperty;
|
||||
* @returns {boolean} Returns `true` if `value` is empty, else `false`.
|
||||
* @example
|
||||
*
|
||||
* isEmpty(null);
|
||||
* isEmpty(null)
|
||||
* // => true
|
||||
*
|
||||
* isEmpty(true);
|
||||
* isEmpty(true)
|
||||
* // => true
|
||||
*
|
||||
* isEmpty(1);
|
||||
* isEmpty(1)
|
||||
* // => true
|
||||
*
|
||||
* isEmpty([1, 2, 3]);
|
||||
* isEmpty([1, 2, 3])
|
||||
* // => false
|
||||
*
|
||||
* isEmpty({ 'a': 1 });
|
||||
* isEmpty({ 'a': 1 })
|
||||
* // => false
|
||||
*/
|
||||
function isEmpty(value) {
|
||||
if (value == null) {
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
if (isArrayLike(value) &&
|
||||
(Array.isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
|
||||
isBuffer(value) || isTypedArray(value) || isArguments(value))) {
|
||||
return !value.length;
|
||||
return !value.length
|
||||
}
|
||||
const tag = getTag(value);
|
||||
const tag = getTag(value)
|
||||
if (tag == '[object Map]' || tag == '[object Set]') {
|
||||
return !value.size;
|
||||
return !value.size
|
||||
}
|
||||
if (isPrototype(value)) {
|
||||
return !baseKeys(value).length;
|
||||
return !baseKeys(value).length
|
||||
}
|
||||
for (const key in value) {
|
||||
if (hasOwnProperty.call(value, key)) {
|
||||
return false;
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return true
|
||||
}
|
||||
|
||||
export default isEmpty;
|
||||
export default isEmpty
|
||||
|
||||
Reference in New Issue
Block a user