Files
Ghom 291dcf9515 Merge pull request #10575 from Arturlang/TGUIs_Nexties
[TESTMERGE] Properly working TGUI Next
2021-01-04 19:47:54 -03:00

20 lines
507 B
JavaScript

/**
* Limits a number to the range between 'min' and 'max'.
*/
export const clamp = (value, min = 0, max = 1) => {
return Math.max(min, Math.min(value, max));
};
/**
* Returns a rounded number.
* TODO: Replace this native rounding function with a more robust one.
*/
export const round = value => Math.round(value);
/**
* Returns a string representing a number in fixed point notation.
*/
export const toFixed = (value, fractionDigits = 0) => {
return Number(value).toFixed(fractionDigits);
};