src/phonelib.js
function format(number, countryCode, type) {
    try {
        var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
        var numberObj = phoneUtil.parseAndKeepRawInput(number, countryCode || '');
        type = (typeof type == "undefined") ? i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL : type;
        if (type == 0) {
            return phoneUtil.format(numberObj, i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL).replace(/[\-\(\)\s\.]/g, '').replace('ext', ',');
        }
        return phoneUtil.format(numberObj, type);
    } catch (e) {
        return "";
    }
}
function format(number, countryCode, type) {
    try {
        var phoneUtil = i18n.phonenumbers.PhoneNumberUtil.getInstance();
        var numberObj = phoneUtil.parseAndKeepRawInput(number, countryCode || '');
        type = (typeof type == "undefined") ? i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL : type;
        if (type == 0) {
            return phoneUtil.format(numberObj, i18n.phonenumbers.PhoneNumberFormat.INTERNATIONAL).replace(/[\-\(\)\s\.]/g, '').replace('ext', ',');
        }
        return phoneUtil.format(numberObj, type);
    } catch (e) {
        return "";
    }
}
function format ( number , countryCode , type ) { try { var phoneUtil = i18n . phonenumbers . PhoneNumberUtil . getInstance ( ) ; var numberObj = phoneUtil . parseAndKeepRawInput ( number , countryCode || '' ) ; type = ( typeof type == "undefined" ) ? i18n . phonenumbers . PhoneNumberFormat . INTERNATIONAL : type ; if ( type == 0 ) { return phoneUtil . format ( numberObj , i18n . phonenumbers . PhoneNumberFormat . INTERNATIONAL ) . replace ( / [\-\(\)\s\.] / g , '' ) . replace ( 'ext' , ',' ) ; } return phoneUtil . format ( numberObj , type ) ; } catch ( e ) { return "" ; } }
format the given number to the given type
format the given number to the given type