123456789101112131415161718192021222324252627 |
- import Metadata from '../metadata.js';
- var SINGLE_IDD_PREFIX_REG_EXP = /^[\d]+(?:[~\u2053\u223C\uFF5E][\d]+)?$/;
- export default function getIddPrefix(country, callingCode, metadata) {
- var countryMetadata = new Metadata(metadata);
- countryMetadata.selectNumberingPlan(country, callingCode);
- if (countryMetadata.defaultIDDPrefix()) {
- return countryMetadata.defaultIDDPrefix();
- }
- if (SINGLE_IDD_PREFIX_REG_EXP.test(countryMetadata.IDDPrefix())) {
- return countryMetadata.IDDPrefix();
- }
- }
|