I'm trying to simplify the following if
statement into a ternary statement. The challenge is that the value of group
needs to be based on the value of coverageLineId
.
let group = (coverageLineId == 1) ? this.medicalBenefitsGroupsView.find((x) => x.value === groupValue)
: (coverageLineId == 2) ? this.dentalBenefitsGroupsView.find((x) => x.value === groupValue)
: (coverageLineId == 3) ? this.visionBenefitsGroupsView.find((x) => x.value === groupValue) : undefined;