Let's cache this after you set it, since you need to use it so many times below:

```javascript
var filter = {},
  filterType = filter[ type ] = {};
...
  filterType[ key ] = map[ key ]
```