mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 13:32:00 +00:00
feat: add safeRound helper function
This commit is contained in:
@@ -31,6 +31,11 @@ export const formatNumber = (
|
|||||||
}).format(value);
|
}).format(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const safeRound = (num: number, decimals: number) => {
|
||||||
|
const factor = 10 ** decimals;
|
||||||
|
return Math.round((num + Number.EPSILON) * factor) / factor;
|
||||||
|
};
|
||||||
|
|
||||||
export const formatTitleCase = (value: string) => {
|
export const formatTitleCase = (value: string) => {
|
||||||
return value
|
return value
|
||||||
.toLowerCase()
|
.toLowerCase()
|
||||||
|
|||||||
Reference in New Issue
Block a user