Filter Schema in Javascript

I was having issues getting the filter to work correctly in Javascript. The javascript tab was missing on the documentation. I was able to get it working by using the following code:

schema.defineTypes(Player, {
  owner: "string",
  secret: "string"
})

schema.filter(function(client) {
  return this.owner === client.sessionId && this.secret
})(Player, "secret")

However some modifications were needed for this to get passed correctly. Specifically in annotations.js I had to change filter function to:

function filter(cb) {
    return function (target, field) {
        /*
         * static filters
         */
        if (!target._filters) {
            target._filters = {};
        }
        target._filters[field] = cb;
    };
}
exports.filter = filter;

This issue was it was adding to the schemas constructor _filters variable but in the schema serializer it was looking for newState['_filters'])

this.hasFiltersByClient = this.hasFilter(newState['_schema'], newState['_filters']);

After those changes were made the data is successfully protected from other clients and shows undefined instead of the string "secret"

Is this change going to break something else? Was adding to the _filters in the schema constructor being pulled from another section?

Pass Player.prototype to filter() in Javascript.
There is no need to modify code.