Frontend stuff

This commit is contained in:
maciejhirsz
2018-07-02 16:07:16 +02:00
parent fe2419e54b
commit 1eea35b7ce
204 changed files with 659 additions and 227 deletions
+25
View File
@@ -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);
}