numberFormater.js 418 Bytes
'use strict';

export function number10KFormater(number) {
    if (number < 10000) {
        return number + '';
    } else {
        let unit = calcluateUnit(number, 10000);
        return `${unit}W+`;
    }
}

function calcluateUnit(number, devider) {
    devider = parseInt(devider);
    if (devider == 0) {
        return number;
    }
    let result = Math.floor(parseInt(number) / devider);
    return result;
}