import moment from "moment";
function genTaskId(code) {
    return code + moment(new Date()).format("YYYYMMDDHHmmssSSS");
}

function toCamelCase(str) {
    return str.replace(/-(\w)/g, function (_, c) {
        return c ? c.toUpperCase() : "";
    });
}

function toUnderScoreCase(str) {
    return str.replace(/([A-Z])/g, function (_, c) {
        return "_" + c.toLowerCase();
    });
}

function isSingleCharacter(c) {
    if (c.length !== 1) {
        return false
    }
    return c.toLowerCase() >= 'a' && c.toLowerCase() <= 'z'
}

function isNumber(d) {
    return d >= '0' && d <= '9'
}

export {
    genTaskId,
    toCamelCase,
    toUnderScoreCase,
    isSingleCharacter,
    isNumber
}