This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
|
const formatNumber = (variant: 'commas', v: number | string): string => {
|
|
if (typeof v === 'string') {
|
|
v = parseFloat(v);
|
|
}
|
|
switch (variant) {
|
|
case 'commas':
|
|
return v.toLocaleString('en');
|
|
default:
|
|
return v + '';
|
|
}
|
|
};
|
|
|
|
export default formatNumber;
|