Depends on instance attribute `hasOwnProperty`
Closed this issue · 1 comments
jdthorpe commented
These calls all throw the error 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;
}