Round using AmountShortenerPipe

This commit is contained in:
nymkappa
2022-03-25 11:38:36 +09:00
parent a016d1c071
commit c5837ab9df
3 changed files with 7 additions and 7 deletions

View File

@@ -5,11 +5,12 @@ import { Pipe, PipeTransform } from '@angular/core';
})
export class AmountShortenerPipe implements PipeTransform {
transform(num: number, ...args: number[]): unknown {
const digits = args[0] || 1;
if (num < 1000) {
return num;
return num.toFixed(digits);
}
const digits = args[0] || 1;
const lookup = [
{ value: 1, symbol: '' },
{ value: 1e3, symbol: 'k' },