Hi I have an array of objects which string starts with a specific prefix and if that key value is true then remove all the objects in an array that contains the same key(prefix)
below is the array of object:
const data = [{
    field_name_key: "Recive_IsViaEmail",
    fieldValue: false
  },
  {
    field_name_key: "Recive_IsViaSMS",
    fieldValue: false
  },
  {
    field_name_key: "Sender_IsViaEmail",
    fieldValue: false
  },
  {
    field_name_key: "Sender_IsViaSMS",
    fieldValue: true
  },
]here "Sender_IsViaSMS" contains true hence remove all the objects that start with the prefix key Sender_IsVia
Final result is this:
const data = [{
    field_name_key: "Recive_IsViaEmail",
    fieldValue: false
  },
  {
    field_name_key: "Recive_IsViaSMS",
    fieldValue: false
  }
] 
     
     
    