Guard against mime.lookup('foo.constructor') trying to return the lookup table's constructor #24

Merged
merged 3 commits into from Feb 16, 2012

2 participants

@jfhbrook

See jfhbrook/node-ecstatic#15 for a more in-depth explanation of the issue.

Thanks! ^__^

@broofa
Owner

Thanks for the request! Can we inline the hasOwnProperty() check instead of defining the has() method? (Does has() really add that much value?)

if (mime.types.hasOwnProperty(ext) {
...
@jfhbrook

Yes, inlining it should work. I added a test, so you can check too.

@broofa broofa merged commit 39ef52a into broofa:master Feb 16, 2012
@broofa broofa added a commit that referenced this pull request Feb 16, 2012
@broofa patchup README and #24 68f653f
@broofa
Owner

Oh, sweet, just discovered the "Object.create(null)" trick that creates an Object instance that doesn't inherit from Object.prototype.

See comments in http://www.devthought.com/2012/01/18/an-object-is-not-a-hash/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment