title: ES6 : How to push unique values in an Array while adding the duplicate ones?
body: <p>I have an array of objects like : </p>
  
  <pre><code>[
    {
      "name": "Apple",
      "amount": 5
    },
    {
      "name": "Tomato",
      "amount": 10
    }
  ]
  </code></pre>
  
  <p>Requirement is when I push a object like </p>
  
  <pre><code>{
     "name": "Apple",
     "amount": 10
  }
  </code></pre>
  
  <p>Expected Result:</p>
  
  <pre><code>[
    {
      "name": "Apple",
      "amount": 15
    },
    {
      "name": "Tomato",
      "amount": 10
    }
  ]
  </code></pre>
  
  <p>But on pushing unique entry like <code>{"name":"Orange","amount":15}</code>, the resulting array should be: </p>
  
  <pre><code>[{"name":"Apple","amount":5},{"name":"Tomato","amount":10},{"name":"Orange","amount":15}]
  </code></pre>