I have an if-statement that looks like this:
if ("Bolagsmän" in nicerows){
var contact = this.makeContact(nicerows['Bolagsmän'],true);
}
else if ("Komplementär(er)" in nicerows){
var contact = this.makeContact(nicerows['Komplementär(er)'],true);
}
else if("Innehavare" in nicerows){
var contact = this.makeContact(nicerows['Innehavare'],false);
}
else if("Styrelseledamot, verkställande direktör" in nicerows){
var contact = this.makeContact(nicerows['Styrelseledamot, verkställande direktör'], true);
}
else if("Styrelseledamöter" in nicerows){
var contact = this.makeContact(nicerows['Styrelseledamöter'], true);
}
As you can see it is a lot of code multiplication just because there are a few possible variables. is there any cleaner way to do this?