diff --git a/packages/object-is-empty/index.cjs b/packages/object-is-empty/index.cjs index 5e679b7c5..39a8c6fc8 100644 --- a/packages/object-is-empty/index.cjs +++ b/packages/object-is-empty/index.cjs @@ -39,7 +39,7 @@ function isEmpty(obj) { var type = {}.toString.call(obj); if (type == '[object Object]') { - return !Object.keys(obj).length; + return !Object.keys(obj).length && !Object.getOwnPropertySymbols(obj).length; } if (type == '[object Map]' || type == '[object Set]') { diff --git a/packages/object-is-empty/index.mjs b/packages/object-is-empty/index.mjs index 224f14fff..a814e6f88 100644 --- a/packages/object-is-empty/index.mjs +++ b/packages/object-is-empty/index.mjs @@ -39,7 +39,7 @@ function isEmpty(obj) { var type = {}.toString.call(obj); if (type == '[object Object]') { - return !Object.keys(obj).length; + return !Object.keys(obj).length && !Object.getOwnPropertySymbols(obj).length; } if (type == '[object Map]' || type == '[object Set]') { diff --git a/test/object-is-empty/index.cjs b/test/object-is-empty/index.cjs index 9f8cdc5af..3dfb88d08 100644 --- a/test/object-is-empty/index.cjs +++ b/test/object-is-empty/index.cjs @@ -13,8 +13,9 @@ test('empty object, array, map or set', function(t) { }); test('non-empty object, array, map or set', function(t) { - t.plan(6); + t.plan(7); t.notOk(isEmpty({a: 3, b: 5})); + t.notOk(isEmpty({[Symbol('a')]: "some-value"})); t.notOk(isEmpty([1, 2])); t.notOk(isEmpty(['a', 'b'])); t.notOk(isEmpty(new Array(4)));