Find number matching range
This function has very slightly different boundaries, but you may find it does better than what you have right now:

function degreesToOrientation(degrees){
    return 1 + Math.floor(((Number(degrees) + 180 + 11.25) % 360.0) / 22.5);
}


one sixteenth of a circle is 22.5 degrees. centering that is at 11.25 degrees.

So, you add 11.25 degrees to your angle, rotate it a further 180 degrees, Use the Modulo to bring the value back in to range, then divide it by the size of each segment.

This returns a value from 0 through 15 (for the 16 segments). So, add 1 to get your 'orientation'.

It does not care about the degree amount as long as it is greater than -191.25 ... to start with... (the modulo operation is funny with negative numbers...)

Here is a jfiddle