Can I refactor if - else with a switch or case statement in javascript?
<p>I have the following code:</p>

<pre><code>var btns1 = {
    'Submit': function (win) {
        submitHandler(oLink.$link, $('#main-form'), false);
    },
    'Submit &amp; Close': function (win) {
        submitHandler(oLink.$link, $('#main-form'), true);
    },
    'Close': function (win) {
        modal.closeModal()
    }
}
var btns2 = {
    'Submit &amp; Close': function (win) {
        submitHandler(oLink.$link, $('#main-form'), true);
    },
    'Close': function (win) {
        modal.closeModal()
    }
}

if (oLink.title.substr(0, 4) == "Crea") {
    if (content.match(/data-RowKey="(.{3}).*/)) {
        oLink.title += " " + content.match(/data-RowKey="(.{3}).*/)[1]
    }
    var btns = btns1;
}
if (oLink.title.substr(0, 4) == "Edit") {
    var btns = btns1;
}
if (oLink.title.substr(0, 4) == "Dele") {
    var btns = btns2;
}
</code></pre>

<p>Is there a way that I could refactor the code. What I was thinking was to put this into a function called "adminModalBtns", have it take oLink and content as a parameter and have it return btns. Would it be most clear to do this with if-else or a case statement?</p>
