Closed jdthorpe closed 8 years ago
These calls all throw the error TypeError: object.hasOwnProperty is not a function:
TypeError: object.hasOwnProperty is not a function
sizeof = require('object-sizeof') sizeof({hasOwnProperty:undefined}) sizeof({hasOwnProperty:"Hello World"}) sizeof({hasOwnProperty:1234})
For greater robustness, I recommend changing this:
if(!object.hasOwnProperty(key)){ continue; }
to the more general:
if(!Object.hasOwnProperty.call(object,key)){ continue; }
thank you, @jdthorpe fixed https://github.com/miktam/sizeof/pull/14
These calls all throw the error
TypeError: object.hasOwnProperty is not a function
:For greater robustness, I recommend changing this:
to the more general: