mirror of
https://github.com/pezkuwichain/pezkuwi-telemetry.git
synced 2026-04-25 10:37:59 +00:00
Frontend stuff
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
export function formatNumber(num: number): string {
|
||||
const input = num.toString();
|
||||
|
||||
let output = '';
|
||||
let length = input.length;
|
||||
|
||||
while (length > 3) {
|
||||
output = ',' + input.substr(length - 3, 3) + output;
|
||||
length -= 3;
|
||||
}
|
||||
|
||||
output = input.substr(0, length) + output;
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
export function trimHash(hash: string, length: number): string {
|
||||
if (hash.length < length) {
|
||||
return hash;
|
||||
}
|
||||
|
||||
const side = ((length - 2) / 2) | 0;
|
||||
|
||||
return hash.substr(0, side) + '..' + hash.substr(-side, side);
|
||||
}
|
||||
Reference in New Issue
Block a user