INNER CODE UNIT · JavaScript

addDots

mdziekon/UniEngine · js/_libCommon.js:4

const addDots = (value) => {
    value += "";
    var rgx = /(\d+)(\d\d\d)/;
    while (rgx.test(value)) {
        value = value.replace(rgx, "$1" + "." + "$2");
    }
    return value;
};
// TODO: Also defined in common.js, deduplicate
const padStringLeft = (value, desiredLenght, padString) => {
    const strValue = String(value);
    const lengthLeft = desiredLenght - (strValue.length);

    if (lengthLeft <= 0) {
        return strValue;
    }

    const padding = (new Array(lengthLeft)).fill(padString, 0, lengthLeft).join("");

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…