File size: 462 Bytes
c23f777 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | module.exports = (number) => {
let num = Number(number);
let out;
if (Math.abs(num) < 999) {
out = num;
}
if (Math.abs(num) >= 999) {
out = Math.sign(num) * (Math.abs(num) / 1000).toFixed(1) + "k+";
}
if (Math.abs(num) >= 999999) {
out = Math.sign(num) * (Math.abs(num) / 1000000).toFixed(1) + "m+";
}
if (Math.abs(num) >= 999999999) {
out = Math.sign(num) * (Math.abs(num) / 1000000000).toFixed(1) + "b+";
}
return out;
};
|