@flabdablet I mean, if there's going to be a lot of forcing stuff to fit within bounds I'd factor it out and just havea = FitToBounds(a, MIN, MAX);
I wouldn't. You'd have to go look at FitToBounds() to find out whether the bounds were inclusive or not, which order to specify them in and what it does if you specify a lower bound that's higher than the upper bound.
Also, the instant you made a FitToBounds(), some prick would stick it in npm and it would become a world-breaking dependency.
Simple logic like this is one of the very few places where copypasta works better.