I have a type Bound
as a sort of "alias" for an array of three numbers (working in TypeScript with: type Bound = [number, number, number]
). I did this basically to help readability by specifying in the name what the array is used for. However, sometimes in my app I need to convert a number to a Bound and vice versa (for example 99
would translate to [0, 9, 9]
). The code for this is fairly simple, but I'm wondering where would I place such a function? There seems to be no agreed-upon place to put conversion functions.
That is my specific problem, but the general question is there: Where should functions that convert types be placed?