So here's the situation:
I have an object that looks like this
var obj = { name1: somevalue1, name2: somevalue2, name3: somevalue3}
Followed by an array
var arr = [name2, name3]
Both of these are dynamically generated. What I need to do is filter the object using the array (based on property names, not their values). However, all the methods I've come across so far focus on filtering by values. Therefore, the desired result should look like this:
var result = {name2: somevalue2, name3: somevalue3}
I'm working with Angular and Underscore. The filtering needs to be done in the controller, not in the template. Any assistance would be greatly appreciated!