lion/packages/input-tel-dropdown/src/getFlagSymbol.js
gerjanvangeest 7239d60466
Fix/input tel format options (#1733)
* fix(input-tel): remove unwanted characters in parser

* feat(input-tel-dropdown): export getFlagSymbol function

* feat(input-tel): add formatCountryCodeStyle option
2022-06-15 08:11:40 +02:00

13 lines
339 B
JavaScript

/**
* @param {string} char
*/
function getRegionalIndicatorSymbol(char) {
return String.fromCodePoint(0x1f1e6 - 65 + char.toUpperCase().charCodeAt(0));
}
/**
* @param {string} regionCode
*/
export function getFlagSymbol(regionCode) {
return getRegionalIndicatorSymbol(regionCode[0]) + getRegionalIndicatorSymbol(regionCode[1]);
}