MCPcopy Index your code
hub / github.com/Lobos/react-ui / isEmpty

Function isEmpty

src/utils/objects.js:7–30  ·  view source on GitHub ↗
(obj)

Source from the content-addressed store, hash-verified

5export const deepEqual = require('./deepEqual');
6
7export function isEmpty (obj) {
8 // null and undefined are "empty"
9 if (obj === null || obj === undefined) {
10 return true;
11 }
12
13 if (typeof obj === 'number' && isNaN(obj)) {
14 return true;
15 }
16
17 if (obj.length !== undefined) {
18 return obj.length === 0;
19 }
20
21 if (obj instanceof Date) {
22 return false;
23 }
24
25 if (typeof obj === 'object') {
26 return Object.keys(obj).length === 0;
27 }
28
29 return false;
30}
31
32export function forEach (obj, fn, context) {
33 Object.keys(obj).forEach((key) => fn.call(context, obj[key], key));

Callers 2

renderMarksMethod · 0.90
objects.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…