mars-v2-frontend/utils/formatters.ts
Linkie Link 27cdd1c954
Linter and prettier adjustments (#50)
* tidy: added eslintrc and prettierrc rules

* tidy: formated the files via ‚yarn format‘

* import sort improvements

* format script regex fix

* replace eslint import severity to warning

* remove staged file

Co-authored-by: Gustavo Mauricio <gustavo.mauricio58@gmail.com>
2022-11-09 10:04:06 +01:00

18 lines
425 B
TypeScript

export const formatWalletAddress = (address: string, substrLength = 6): string => {
if (address.length <= 10) {
return address
}
return `${address.slice(0, substrLength)}...${address.slice(
address.length - substrLength,
address.length,
)}`
}
export const formatCurrency = (value: string | number) => {
return Number(value).toLocaleString('en-US', {
style: 'currency',
currency: 'USD',
})
}