I have a very strange issue where a module is producing a prototype-less (null) object, which causes Bristol to blow up when the object gets run through the internal forEachObj() function.
I'm honestly not sure if this should be addressed by Bristol, but it would be nice to never have Bristol throw an error (which has been the case up to now).
Here's the code to reproduce the issue:
function forEachObj(obj, cb) {
var brakesOn = false,
brake = function() { brakesOn = true; };
for (var key in obj) {
if (obj.hasOwnProperty(key))
cb(key, obj[key], brake);
if (brakesOn) break;
}
}
let badObj = {value: 5};
badObj.__proto__ = null; // set null proto
forEachObj(badObj, function() {})
// TypeError: obj.hasOwnProperty is not a function
I have a very strange issue where a module is producing a prototype-less (null) object, which causes Bristol to blow up when the object gets run through the internal
forEachObj()
function.I'm honestly not sure if this should be addressed by Bristol, but it would be nice to never have Bristol throw an error (which has been the case up to now).
Here's the code to reproduce the issue:
Any thoughts are appreciated.