* feat: Input, Phone no., Currency Widget * cypress tests, jest test, QA and CR callouts * fix tests * Cypress and jest test fixes
14 lines
447 B
TypeScript
14 lines
447 B
TypeScript
import { ISDCodeOptions } from "constants/ISDCodes_v2";
|
|
|
|
export const countryToFlag = (dialCode: string) => {
|
|
const country = ISDCodeOptions.find((item) => item.dial_code === dialCode);
|
|
const isoCode = country ? country.code : "";
|
|
return typeof String.fromCodePoint !== "undefined"
|
|
? isoCode
|
|
.toUpperCase()
|
|
.replace(/./g, (char) =>
|
|
String.fromCodePoint(char.charCodeAt(0) + 127397),
|
|
)
|
|
: isoCode;
|
|
};
|