How to optimize if.else nesting

if(info.type === "add") {

    cate === "A" ?
        // add A
        : cate === "B" ?
        // add B
            : null;

} else if(info.type === "update") {

    cate === "A" ?
        // update A
        : cate === "B" ?
            // update B 
            : null

}

is similar to this. if.else is used on the outside. Inside is a ternary expression. Is there a clear solution?
is there a way to optimize this nesting of multiple judgments?

Feb.27,2021

to be clear, I think the original program is clearer. If you take a look at your program upstairs, you can only say that it has reduced the amount of code, or reduced the sentences related to logical judgment! Clear? Hehe


switch(`${info.type}_${cate}`) {
    case 'add_A': ..
    ...
}
Menu