title: javascript array filter duplicates by object key
body: <p>I have an array of objects in Javascript</p>
  
  <p>I am trying to filter out duplicates by object value</p>
  
  <ol>
  <li><p>get duplicate </p></li>
  <li><p>get unique</p></li>
  </ol>
  
  <p>example arrays:</p>
  
  <pre><code>let array = [
  { 
      id: '001',
      name: 'aaa',
      type_id: 'a111'
  },{ 
      id: '002',
      name: 'bbb',
      type_id: 'a111'
  },{
      id: '003',
      name: 'ccc',
      type_id: 'a222'
  },{
      id: '004',
      name: 'ddd',
      type_id: 'a333'
  }];
  </code></pre>
  
  <p>This is what i want my array to turn out like:</p>
  
  <pre><code>function 1(array, 'type_id')
  [{ 
      id: '001',
      name: 'aaa',
      type_id: 'a111'
  },{ 
      id: '002',
      name: 'bbb',
      type_id: 'a111'
  }];
  
  function 2(array, 'type_id')
  [{ 
      id: '003',
      name: 'ccc',
      type_id: 'a222'
  },{ 
      id: '004',
      name: 'ddd',
      type_id: 'a333'
  }];
  </code></pre>