sindresorhus/dot-prop



The issue has been solved
get() method's switch to object.prototype.propertyIsEnumerable broke my code #46
joshua-golub posted onGitHub
This change was made in July 2016:
use `object.prototype.propertyIsEnumerable instead of `Object.getOwnPropertyDescriptor`
Unfortunately, this change broke my code. Specifically, I was using it like this in the Express framework:
dot = require( "dot-prop" );
req.app.locals.foo = 1;
console.log( "foo = " + dot.get( req, "app.locals.foo" ) );
where the req
object is defined here.
Before this change, foo = 1
was logged.
After this change, foo = undefined
was logged.
The problem appears to be that req.app
isn't an enumerable property because it is an inherited property.
So, here's my question: why are we discriminating against inherited properties inside the get()
method? That doesn't seem right to me.