Reformatting

This commit is contained in:
maciejhirsz
2018-07-06 17:53:42 +02:00
parent 6fe1e47082
commit 538a30ccc3
20 changed files with 1005 additions and 1001 deletions
+14 -14
View File
@@ -1,25 +1,25 @@
export function formatNumber(num: number): string {
const input = num.toString();
const input = num.toString();
let output = '';
let length = input.length;
let output = '';
let length = input.length;
while (length > 3) {
output = ',' + input.substr(length - 3, 3) + output;
length -= 3;
}
while (length > 3) {
output = ',' + input.substr(length - 3, 3) + output;
length -= 3;
}
output = input.substr(0, length) + output;
output = input.substr(0, length) + output;
return output;
return output;
}
export function trimHash(hash: string, length: number): string {
if (hash.length < length) {
return hash;
}
if (hash.length < length) {
return hash;
}
const side = ((length - 2) / 2) | 0;
const side = ((length - 2) / 2) | 0;
return hash.substr(0, side) + '..' + hash.substr(-side, side);
return hash.substr(0, side) + '..' + hash.substr(-side, side);
}