mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 20:30:33 +00:00
25 lines
638 B
TypeScript
25 lines
638 B
TypeScript
import { IAccount } from '@/interfaces';
|
|
import { Transformer } from '@/lib/Transformer/Transformer';
|
|
import { formatNumber } from 'utils';
|
|
|
|
export class AccountTransformer extends Transformer {
|
|
/**
|
|
* Include these attributes to sale invoice object.
|
|
* @returns {Array}
|
|
*/
|
|
public includeAttributes = (): string[] => {
|
|
return ['formattedAmount'];
|
|
};
|
|
|
|
/**
|
|
* Retrieve formatted account amount.
|
|
* @param {IAccount} invoice
|
|
* @returns {string}
|
|
*/
|
|
protected formattedAmount = (account: IAccount): string => {
|
|
return formatNumber(account.amount, {
|
|
currencyCode: account.currencyCode,
|
|
});
|
|
};
|
|
}
|