I have this function which has complexity greater than 12. I am trying to bring down it's complexity. I searched around but couldn't find anything too useful is it possible to reduce this complexity? - if so, how would I go about doing so?
Here is the function
function sea(name) { +1
if (name === 'sa') { +1
return 'SA'; +1
} else if (name === 'uk') { +1
return 'UK'; +1
} else if (name === 'northkorea') { +1
return 'NK'; +1
} else if (name === 'hongkong') { +1
return 'HK'; +1
} else {
var rs = new RegExp(/\w);
return name.replace(rs, function(up) { +1
return up.charAt(0);
});
}
}```