Won't this fail if VALID_FIELDS is null, as it is on line 24?  What about this (UNTESTED):

```
  return VALID_FIELDS && VALID_FIELDS.indexOf( key ) !== -1;
```