Can you factor all the `data.type` checks with something like:

```javascript
if (!data.type) {
  return;
}
```