I have an object (values). I want to select the field which startWith(')and which contains an object(for this case the 2). I want to delete the entire object from the createValue array and place it in an object CreateFileValue. You can check the output
Example input:
const values = {
  ID: ,
  c: [{
      f: "",
      v: 'hello',
    },
    {
      f: "102",
      fi: "doc.pdf",
      v: {
        f: 'F2',
        fi: '',
        v: 'jkhkjhkhkjh'
      },
    }
  ]
}
Example output:
const values = {
  ID:817,
  c: [{
      f: "F",
      v: 'hello',
    }
  ],
  c: {
    "f": "F",
    "fi": "ff.pdf",
    "v": "jkhkjhkhkjh"
  }
}
const values = {
  ID: 7,
  c: [{
      f: "FL",
      v: 'hello',
    },
    {
      f: "F2",
      fi: "doc.pdf",
      v: {
        f: '',
        fi: '.pdf',
        v: 'jkhkjhkhkjh'
      },
    }
  ]
}
const res = () => {
  if (values.calues.startsWith('') && typeof values.cralues.startsWith('F') === 'object') {
    return {
    };
  }
}
};
console.log(res()); 
     
     
    