title: How to filter the duplicate rows with complex scenarios
body: <p>I would like to filter duplicate rows with some complex scenarios.</p>
  
  <p><strong>For example 1:</strong></p>
  
  <p>ID and Code ID are the same, and the Status is either "Not Reservable" or "Reservable", we will remove the ID and Code ID that have the status of "Reservable"</p>
  
  <p><strong>For example 2:</strong></p>
  
  <p>ID and Code ID are the same, and the Status is either "Completed" or "Reservable", we will remove the ID and Code ID that have the Status of "Completed"</p>
  
  <p><strong>For example 3:</strong></p>
  
  <p>If 2 IDs are the same, and the Code ID is different, we will display both in the list</p>
  
  <pre><code>var new data = [{
      ID: 150042379,
      Name: Cake 1234
      Status: 'Not Reservable'
      Code ID: 302
    },
    {
      ID: 150042379,
      Name: Cake 1234
      Status: 'Reservable'
      Code ID: 302
    },
    {
      ID: 150042379,
      Name: Bread 1236 Ticket
      Status: 'Reservable'
      Code ID: 391
    },
    {
      ID: 150053213,
      Name: Bread Basic 8
      Status: 'Reservable'
      Code ID: 201
    },
    {
      ID: 150053213,
      Name: Bread Basic 6
      Status: 'Reservable'
      Code ID: 301
    },
    {
      ID: 150054121,
      Name: Bread Basic 16
      Status: 'Not Reservable'
      Code ID: 202
    },
    {
      ID: 150054121,
      Name: Bread Basic 16
      Status: 'Reservable'
      Code ID: 202
    },
    {
      ID: 150057599,
      Name: Bread Riche
      Status: 'Reservable'
      Code ID: 232
    },
  ]
  </code></pre>
  
  <hr>
  
  <p>So the result that I want:</p>
  
  <pre><code>var filter_new_data = [{
      ID: 150042379,
      Name: Cake 1234
      Status: 'Not Reservable'
      Code ID: 302
    },
    {
      ID: 150042379,
      Name: Bread 1236 Ticket
      Status: 'Reservable'
      Code ID: 391
    },
    {
      ID: 150053213,
      Name: Bread Basic 8
      Status: 'Reservable'
      Code ID: 201
    },
    {
      ID: 150053213,
      Name: Bread Basic 6
      Status: 'Reservable'
      Code ID: 301
    },
    {
      ID: 150054121,
      Name: Bread Basic 16
      Status: 'Not Reservable'
      Code ID: 202
    },
    {
      ID: 150057599,
      Name: Bread Riche
      Status: 'Reservable'
      Code ID: 232
    },
  ]
  </code></pre>
  
  <hr>
  
  <p>This is my current code and I stuck half way</p>
  
  <pre><code>filter_new_data = Object.values(new_data.reduce((acc, value) =&gt; {
          if (acc[value.ID]) {
            if (acc[value.ID].STATUS === 'Not Reservable') {
              acc[value.ID] = acc[value.ID]
            } else if (acc[value.ID].STATUS === 'Reservable') {
              acc[value.ID] = acc[value.ID]
            } else {
              acc[value.ID] = value
            }
          } else {
            acc[value.ID] = value
          }
          return acc
        }, {}))
  </code></pre>