summaryrefslogtreecommitdiff
path: root/node_modules/moment/src/lib/utils/is-object-empty.js
blob: 62f4e6931dfca6cbe393d95711e655bbfec305cc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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;
    }
}