How to convert HSV to RGB using shader nodes? I am trying to implement the following function that converts HSV to RGB:
HSVtoRGB= function(color) {
    var i;
    var h,s,v,r,g,b;
    h= color[0];
    s= color[1];
    v= color[2];
    if(s === 0 ) {
        // achromatic (grey)
        r = g = b = v;
        return [r,g,b];
    }
    h /= 60;            // sector 0 to 5
    i = Math.floor( h );
    f = h - i;          // factorial part of h
    p = v * ( 1 - s );
    q = v * ( 1 - s * f );
    t = v * ( 1 - s * ( 1 - f ) );
    switch( i ) {
        case 0:
            r = v;
            g = t;
            b = p;
            break;
        case 1:
            r = q;
            g = v;
            b = p;
            break;
        case 2:
            r = p;
            g = v;
            b = t;
            break;
        case 3:
            r = p;
            g = q;
            b = v;
            break;
        case 4:
            r = t;
            g = p;
            b = v;
            break;
        default:        // case 5:
            r = v;
            g = p;
            b = q;
            break;
    }
    return [r,g,b];
}

I'm completely fine up until the large switch/case structure. I have no idea how to implement this without creating a huge mess. It would be fine if each case was changing the same value, but each case has different variable assignments than others.
Here's my current nodegroup:

If someone could guide me to a working solution here, it would very much appreciated!
Is this an exercise,  or ....

... will this do?...
EDIT: No, it won't. If you want to do logic like this by hand..
One way to approach the case statement would be use the implicit cast of True and False to 1 and 0, and multiply the truth-value of the case-condition with the color that would result if it were true.

.. so the above cluster says (v,t,p) * (i == 0) + (q,v,p) * (i == 1) +....
If the i == 0 condition is true, then the (v,t,p) contributes to the sum of colors. If the condition is false, it contributes (0,0,0).  Only one case will be true, and contribute more than 0 to the sum.
You then accumulate a sum of all the colors:

But this stuff can be tedious to debug.. @Rich Sedman's kit can be a fantastic time-saver.