title: Best way to find index of exact same object in object Array (key is dynamic)
body: <p>Let's say I have dynamically loaded object each time with different properties and an array of objects of that type:</p>
  
  <pre><code>var obj = {name: someValue, key: someValue2};
  var objArray = [{name: someValue, key: someValue2},{name: someValue, key: someValue3}];
  </code></pre>
  
  <p>I want to find index of <i>objArray</i> which contains the <i>obj</i>. Some elements of <i>objArray</i> can have the same <i>name</i> property but different <i>key</i> property so searching through <i>obj.name</i> is not an option. So far I came up with this solution:</p>
  
  <pre><code>var keys = [];
  
  _.forEach(Object.keys(obj), function(key) {
    keys.push(key, obj[key])
  });
  
  var index = _.findIndex(objArray, keys);
  </code></pre>
  
  <p>This works fine and all but I am looking for something with better performance because this <i>objArray</i> can be very large.</p>
  
  <p>So the question is: Is there a better way to find index of exact same object in object Array?</p>
  
  <p>Update:
  I forgot to mention that the names of the keys are not specified and can vary each time.</p>