Throws on an empty object without prototype
futpib opened this issue · 1 comments
futpib commented
require('node-object-hash')().hash(Object.create(null))
TypeError: Cannot read property 'name' of undefined
at _guessObjectType (.../node-object-hash/objectSorter.js:20:27)
at _guessType (.../node-object-hash/objectSorter.js:68:37)
at objectToString (.../node-object-hash/objectSorter.js:213:24)
at sortObject (.../node-object-hash/index.js:78:12)
at Object.hashObject [as hash] (.../node-object-hash/index.js:103:18
Here is the offending line (20):
node-object-hash/objectSorter.js
Lines 15 to 21 in 0ac4d88
This assumes that every (non-null) object has as constructor
property, which is not generally the case.
SkeLLLa commented
@futpib
Published as v1.4.0 https://www.npmjs.com/package/node-object-hash/v/1.4.0