export function convertPhoneNumber(phone, countryCode = "62") {
    if(phone.substring(0,1) == "0") {
        phone = countryCode + phone.substring(1);
    } else 
    if(phone.substring(0,2) == "62") {
        phone = countryCode + phone.substring(2);
    } else 
    if(phone.substring(0,3) == "+62") {
        phone = countryCode + phone.substring(3);
    } else
    if(phone.substring(0,1) == "+") {
        phone = phone.substring(1);
    }

    return phone;
}

export function checkPrefixPhoneNumber(phone) {
    const countryCode = "62";
    if(phone.substring(0,1) == "0") {
        phone = countryCode + phone.substring(1);
    } else 
    if(phone.substring(0,1) == "8") {
        phone = countryCode + phone;
    } else 
    if(phone.substring(0,1) == "+") {
        phone = phone.substring(1);
    }

    return phone;
}

export function isPhoneNumber(phone) {
    if (isNaN(phone)) {
        return false;
    } else {
        return true;
    }
}