framework/js/lib/utils/abbreviate-number.js
2015-05-30 08:40:29 +09:30

10 lines
226 B
JavaScript

export default function(number) {
if (number >= 1000000) {
return Math.floor(number / 1000000)+'M';
} else if (number >= 1000) {
return Math.floor(number / 1000)+'K';
} else {
return number.toString();
}
}