natesilva / jayschema

[Unmaintained] - A comprehensive JSON Schema validator for Node.js
BSD 3-Clause "New" or "Revised" License
217 stars 22 forks source link

Support instances without hasOwnProperty method #20

Closed adrianheine closed 10 years ago

adrianheine commented 10 years ago

A validation subject is not necessarily derived from Object, and thus might lack hasOwnProperty.

natesilva commented 10 years ago

Thanks. I’m checking this out and will let you know what I find later.

natesilva commented 10 years ago

Can you show an example? The pull request affects the dependencies and required keywords. I’m having a hard time figuring out a situation where the instance tested would not inherit from Object.

On the other hand, if there is a use case of this, there may be more places in the code where hasOwnProperty should be changed.

adrianheine commented 10 years ago

You might always have an instance which you created with Object.create(null).

natesilva commented 10 years ago

Ah, yes. I’m writing some tests for this and then I’ll merge your pull request. Thanks.