You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
360 B
JavaScript
16 lines
360 B
JavaScript
2 years ago
|
import hasOwnProp from './has-own-prop';
|
||
|
|
||
|
export default function isObjectEmpty(obj) {
|
||
|
if (Object.getOwnPropertyNames) {
|
||
|
return Object.getOwnPropertyNames(obj).length === 0;
|
||
|
} else {
|
||
|
var k;
|
||
|
for (k in obj) {
|
||
|
if (hasOwnProp(obj, k)) {
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
return true;
|
||
|
}
|
||
|
}
|