MCPcopy
hub / github.com/lodash/lodash / isEmpty

Function isEmpty

lodash.js:11578–11600  ·  view source on GitHub ↗

* Checks if `value` is an empty object, collection, map, or set. * * Objects are considered empty if they have no own enumerable string keyed * properties. * * Array-like values such as `arguments` objects, arrays, buffers, strings, or * jQuery-like collections are cons

(value)

Source from the content-addressed store, hash-verified

11576 * // => false
11577 */
11578 function isEmpty(value) {
11579 if (value == null) {
11580 return true;
11581 }
11582 if (isArrayLike(value) &&
11583 (isArray(value) || typeof value == 'string' || typeof value.splice == 'function' ||
11584 isBuffer(value) || isTypedArray(value) || isArguments(value))) {
11585 return !value.length;
11586 }
11587 var tag = getTag(value);
11588 if (tag == mapTag || tag == setTag) {
11589 return !value.size;
11590 }
11591 if (isPrototype(value)) {
11592 return !baseKeys(value).length;
11593 }
11594 for (var key in value) {
11595 if (hasOwnProperty.call(value, key)) {
11596 return false;
11597 }
11598 }
11599 return true;
11600 }
11601
11602 /**
11603 * Performs a deep comparison between two values to determine if they are

Callers

nothing calls this directly

Calls 3

isArrayLikeFunction · 0.85
isPrototypeFunction · 0.85
baseKeysFunction · 0.85

Tested by

no test coverage detected