title: Remove sub-object-duplicates from an array in Javascript / Typescript
body: <p>I have an array full of objects. Almost all objects have a different amount of keys value pairs. Some of these object have the same key value pairs. </p>
  
  <p>Is there a nice way to remove all the sub-object-duplicates? (sub-object-duplicate = and object whose <strong>all</strong> key-value-pairs can be found in another object.)</p>
  
  <p>In the example below e.g. it would remove the all middle objects and leave only the first and last one.</p>
  
  <p>Many thanks in advance : )</p>
  
  <p>The closest I got is using this from <a href="https://stackoverflow.com/questions/2218999/remove-duplicates-from-an-array-of-objects-in-javascript">here</a>, but I do not know how to add the if condition to only check for a property if it exists.</p>
  
  <p>Unique by multiple properties ( id and name )</p>
  
  <pre><code>arr.filter((v,i,a)=&gt;a.findIndex(t=&gt;(t.id === v.id &amp;&amp; t.name===v.name))===i)
  </code></pre>
  
  <p>Input</p>
  
  <pre><code>input = [
    {
      "key0": {
        "key1": "value1",
        "key2": "value1",
        "key3": "value1",
        "key4": "value1",
        "key5": "value1"
      }
    },
    {
      "key0": {
        "key1": "value1",
        "key3": "value1",
        "key5": "value1"
      }
    },
    {
      "key0": {
        "key1": "value1",
        "key2": "value1",
        "key3": "value1"
      }
    },
    {
      "key0": {
        "key1": "value1",
        "key2": "value1",
        "key5": "value1"
      }
    },
    {
      "key0": {
        "key1": "value1",
        "key2": "value2",
        "key3": "value2",
        "key4": "value2",
        "key5": "value2",
        "key6": "value2"
      },
    {
      "key0": {
        "key1": "value2",
        "key2": "value2",
        "key3": "value2",
        "key4": "value2",
        "key5": "value2",
        "key6": "value2"
      }
    }
  ]
  
  </code></pre>
  
  <p>Expected output</p>
  
  <pre><code>output = [
    {
      "key0": {
        "key1": "value1",
        "key2": "value1",
        "key3": "value1",
        "key4": "value1",
        "key5": "value1"
      }
    },
    {
      "key0": {
        "key1": "value2",
        "key2": "value2",
        "key3": "value2",
        "key4": "value2",
        "key5": "value2",
        "key6": "value2",
      }
    }
  ]
  
  </code></pre>