miktam / sizeof

Get size of a JavaScript object

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Include support for symbols

aw-davidson opened this issue · comments

Summary

Symbols are not included in sizeof calculations.

Example

> sizeof({abc: 'def'})
12
> sizeof({[Symbol('abc')]: 'def'})
0

Solution

Use Object.getOwnPropertySymbols to get the obj's symbols to iterate over.

Let me know if this would be useful and I can make a pr.