@beenotung/tslib
Version:
utils library in Typescript
141 lines (140 loc) • 4.94 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tel_handlers = void 0;
const tslib_1 = require("tslib");
// Import handlers
const hk_tel = tslib_1.__importStar(require("./hk"));
const sg_tel = tslib_1.__importStar(require("./sg"));
const au_tel = tslib_1.__importStar(require("./au"));
const cn_tel = tslib_1.__importStar(require("./cn"));
const mo_tel = tslib_1.__importStar(require("./mo"));
const ae_tel = tslib_1.__importStar(require("./ae"));
const th_tel = tslib_1.__importStar(require("./th"));
const in_tel = tslib_1.__importStar(require("./in"));
const jp_tel = tslib_1.__importStar(require("./jp"));
const vn_tel = tslib_1.__importStar(require("./vn"));
const id_tel = tslib_1.__importStar(require("./id"));
const my_tel = tslib_1.__importStar(require("./my"));
const us_tel = tslib_1.__importStar(require("./us"));
const ch_tel = tslib_1.__importStar(require("./ch"));
const fr_tel = tslib_1.__importStar(require("./fr"));
const de_tel = tslib_1.__importStar(require("./de"));
const it_tel = tslib_1.__importStar(require("./it"));
const es_tel = tslib_1.__importStar(require("./es"));
const nl_tel = tslib_1.__importStar(require("./nl"));
const be_tel = tslib_1.__importStar(require("./be"));
const at_tel = tslib_1.__importStar(require("./at"));
/**
* Registry for all country handlers
* Order matters: unique patterns first, then overlapping patterns
* Registration order determines auto-detection priority
*/
exports.tel_handlers = [];
// Register all countries
// Order matters: unique patterns first, then overlapping patterns
// Countries with unique patterns are registered first
exports.tel_handlers.push({
country_code: '+852',
to_full: hk_tel.to_full_hk_mobile_phone,
format: hk_tel.format_hk_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+65',
to_full: sg_tel.to_full_sg_mobile_phone,
format: sg_tel.format_sg_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+86',
to_full: cn_tel.to_full_cn_mobile_phone,
format: cn_tel.format_cn_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+853',
to_full: mo_tel.to_full_mo_mobile_phone,
format: mo_tel.format_mo_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+971',
to_full: ae_tel.to_full_ae_mobile_phone,
format: ae_tel.format_ae_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+91',
to_full: in_tel.to_full_in_mobile_phone,
format: in_tel.format_in_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+81',
to_full: jp_tel.to_full_jp_mobile_phone,
format: jp_tel.format_jp_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+60',
to_full: my_tel.to_full_my_mobile_phone,
format: my_tel.format_my_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+1',
to_full: us_tel.to_full_us_mobile_phone,
format: us_tel.format_us_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+34',
to_full: es_tel.to_full_es_mobile_phone,
format: es_tel.format_es_mobile_phone,
}); // 9 digits, no leading 0 - unique pattern
exports.tel_handlers.push({
country_code: '+84',
to_full: vn_tel.to_full_vn_mobile_phone,
format: vn_tel.format_vn_mobile_phone,
}); // Has unique 03x/05x prefixes
exports.tel_handlers.push({
country_code: '+66',
to_full: th_tel.to_full_th_mobile_phone,
format: th_tel.format_th_mobile_phone,
}); // Has unique 08x/09x prefixes
exports.tel_handlers.push({
country_code: '+61',
to_full: au_tel.to_full_au_mobile_phone,
format: au_tel.format_au_mobile_phone,
}); // Check before Belgium
exports.tel_handlers.push({
country_code: '+62',
to_full: id_tel.to_full_id_mobile_phone,
format: id_tel.format_id_mobile_phone,
}); // Variable length
exports.tel_handlers.push({
country_code: '+41',
to_full: ch_tel.to_full_ch_mobile_phone,
format: ch_tel.format_ch_mobile_phone,
}); // Check before France
exports.tel_handlers.push({
country_code: '+33',
to_full: fr_tel.to_full_fr_mobile_phone,
format: fr_tel.format_fr_mobile_phone,
}); // Check before Netherlands
exports.tel_handlers.push({
country_code: '+49',
to_full: de_tel.to_full_de_mobile_phone,
format: de_tel.format_de_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+39',
to_full: it_tel.to_full_it_mobile_phone,
format: it_tel.format_it_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+43',
to_full: at_tel.to_full_at_mobile_phone,
format: at_tel.format_at_mobile_phone,
});
exports.tel_handlers.push({
country_code: '+31',
to_full: nl_tel.to_full_nl_mobile_phone,
format: nl_tel.format_nl_mobile_phone,
}); // Most generic, check last
exports.tel_handlers.push({
country_code: '+32',
to_full: be_tel.to_full_be_mobile_phone,
format: be_tel.format_be_mobile_phone,
}); // Check after Australia