geraintluff/tv4 — pull request #78 by hegemonic (2013-12-03 22:18:00+00:00)
Title: ignore inherited and non-enumerable object properties

The current version of `tv4` includes several methods that iterate over object properties without filtering out inherited and non-enumerable properties. As a result, the `data` object fails validation in the following example, because `data` inherits the `extraMethod` property:

```js
function DataMaker(o) {
var self = this;
Object.keys(o).forEach(function(key) {
self[key] = o[key];
});
}

DataMaker.prototype.extraMethod = function() {};

var schema = {
properties: {
foo: {type: 'boolean'}
},
additionalProperties: false
};
var data = new DataMaker({foo: true});

tv4.normSchema(schema);
var valid = tv4.validate(data, schema);
```

This pull request fixes the issue by iterating over the return value of `Object.keys(obj)` rather than calling `for (var prop in obj)`. If you'd prefer to fix this issue in a different way, I'd be happy to close this pull request and submit a new one.