Round using AmountShortenerPipe

This commit is contained in:
nymkappa committed 2022-03-25 11:39:29 +09:00
1 parent b566eb7d59
commit 1d8de2e374
3 files changed
+7 -7

No files matched your search

@@ -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' },