mirror of
https://github.com/mempool/mempool.git
synced 2025-03-03 17:47:01 +01:00
parent
31a0d44543
commit
8cb1c5c88c
1 changed files with 9 additions and 4 deletions
|
@ -1,15 +1,20 @@
|
||||||
import { Pipe, PipeTransform } from "@angular/core";
|
import { formatNumber } from "@angular/common";
|
||||||
|
import { Inject, LOCALE_ID, Pipe, PipeTransform } from "@angular/core";
|
||||||
|
|
||||||
@Pipe({
|
@Pipe({
|
||||||
name: "feeRounding",
|
name: "feeRounding",
|
||||||
})
|
})
|
||||||
export class FeeRoundingPipe implements PipeTransform {
|
export class FeeRoundingPipe implements PipeTransform {
|
||||||
|
constructor(
|
||||||
|
@Inject(LOCALE_ID) private locale: string,
|
||||||
|
) {}
|
||||||
|
|
||||||
transform(fee: number): string {
|
transform(fee: number): string {
|
||||||
if (fee >= 100) {
|
if (fee >= 100) {
|
||||||
return fee.toFixed(0);
|
return formatNumber(fee, this.locale, '1.0-0')
|
||||||
} else if (fee < 10) {
|
} else if (fee < 10) {
|
||||||
return fee.toFixed(2);
|
return formatNumber(fee, this.locale, '1.2-2')
|
||||||
}
|
}
|
||||||
return fee.toFixed(1);
|
return formatNumber(fee, this.locale, '1.1-1')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue