mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-24 22:03:21 +03:00
16 lines
318 B
JavaScript
16 lines
318 B
JavaScript
export const makeCountFriendly = (value) => {
|
|
if (!value) {
|
|
return value;
|
|
}
|
|
if (value >= 1000000) {
|
|
return `${intlFormat(value / 1000000)}M`;
|
|
}
|
|
if (value >= 1000) {
|
|
return `${intlFormat(value / 1000)}K`;
|
|
}
|
|
|
|
return intlFormat(value);
|
|
};
|
|
|
|
const intlFormat = (num) => Math.round(num * 10) / 10;
|