How about changing this to a `filter` to save a line?

```javascript
var attrs = _.filter(attr, function(attribute, index) {
  return _.has(val, index) ? val[index]: null;
});
```