import moment from "moment";
export const genTaskId = (code) => {
    return code + moment(new Date()).format("YYYYMMDDHHmmssSSS");
}

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

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

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

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