Initial commit: Tapalka monorepo (bot, front, strapi)
This commit is contained in:
14
CMyTapper/robucks-front/utils/FormatNumber.ts
Normal file
14
CMyTapper/robucks-front/utils/FormatNumber.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
export function FormatNumber(num: number): string {
|
||||
return Array.from(String(num))
|
||||
.reverse()
|
||||
.map((a, i) => {
|
||||
if (i % 3 == 0 && i > 0) return a + '.';
|
||||
return a;
|
||||
})
|
||||
.reverse()
|
||||
.join('');
|
||||
}
|
||||
|
||||
export const toFixed = (value: string | number | undefined, decimals: number = 4) => {
|
||||
return Number(Number(value).toFixed(decimals));
|
||||
};
|
||||
Reference in New Issue
Block a user