title: Filter the array of objects in javascript based on severity and uniqueness
body: <p>Consider the below as my input array of objects:</p>
  <pre><code>    const arr = [ { src: 'x1', dst: 'x2', severity: null}, 
                    { src: 'x1', dst: 'x2', severity: null},
                    { src: 'x1', dst: 'x2', severity: 1},
                    { src: 'x1', dst: 'x2', severity: 2},
                    { src: 'x1', dst: 'x2', severity: 3},
                    { src: 'x1', dst: 'x2', severity: 4},
                    { src: 'x1', dst: 'x2', severity: 5},
                    { src: 'x1', dst: 'x2', severity: 6},
                    { src: 'x1', dst: 'x2', severity: 7},
                    { src: 'x2', dst: 'x1', severity: null},
                    { src: 'x2', dst: 'x1', severity: null},
                    { src: 'x2', dst: 'x1', severity: 5},
                    { src: 'x2', dst: 'x1', severity: 1},
                    { src: 'x3', dst: 'x4', severity: null}
                 ];
  </code></pre>
  <p>Here src, dst and severity represents source, destination and severity of the array values. the expected result should be like below:</p>
  <pre><code>    [
        { src: ‘x1’, dst: ‘x2’, severity: 7 },
        { src: ‘x2’, dst: ‘x1’, severity: 5 },
        { src: ‘x3’, dst: ‘x4’, severity: null }
      ]
  </code></pre>
  <p>Basically I would have to get the array with unique src and dst, also having the highest value of severity, say here for x1 as src and x2 as destination 7 is the highest severity value, hence it is added to the resultant array, similarly for x2 as dst and x1 as src.</p>
  <p>In case of x3 as src and x4 as dst there are no other values with x3 as src and x4 as destination hence only severity available is null, hence it is added to the array.</p>