You can also try this:

```
function get_subcategories_for(category_id, category_array) {
  return _.chain(category_array)
    .filter(function(category) {
      return category["id"] == category_id
    })
    .filter(function(category) {
      return category["subcategories"] != undefined
    })
    .map(function(category) {
      return category["subcategories"];
    })
    .first() // fallback to first
    .value();
}
```