title: How to merge two arrays based on the property value in react with ES6
body: <p>I have two arrays:</p>
  
  <pre><code> a = [{"sourceId": "1", "targetId": "2", "name": "heats air"} , 
        {"sourceId": "3", "targetId": "4", "name": "power"}]
  
   b = [{"name": "Hair Dryer", "id": "1"}, 
        {"name": "Heating System", "id": "2"}, 
        {"name": "Mains", "id": "3"}, 
        {"name": "Blower", "id": "4"}]
  </code></pre>
  
  <p>How do I get the output like this:</p>
  
  <pre><code>[{"sourceId": "1", "targetId": "2", "name": "heats air", "from": "Hair Dryer", "to": "Heating System"}, 
   {"sourceId": "3", "targetId": "4", "name": "power","from": "Mains", "to": "Blower"]
  </code></pre>
  
  <p>I want to merge them based on the property values: the keys "sourceId" and "targetId" of array a should correspond to the key "id" of array b. If a sourceId is matched with an id, add the value of the name with key "from" to the object in array a;   If a targetId is matched with an id, add the value of the name with key "to" to the item in array a. Also,I am wondering whether I can do this without using lodash. (using ES6)</p>