refactor: separation of shared components

This commit is contained in:
2025-08-06 21:43:43 +04:00
parent 6efb75ab30
commit e43a8b0865
28 changed files with 49 additions and 48 deletions

View File

@ -0,0 +1,14 @@
import { CountryCode, getExampleNumber } from "libphonenumber-js";
import examples from "libphonenumber-js/examples.mobile.json";
import { getCountryCallingCode } from "libphonenumber-js/max";
export default function getPhoneMask(countryCode: CountryCode) {
let example = getExampleNumber(
countryCode,
examples
)!.formatInternational();
const callingCode = getCountryCallingCode(countryCode);
const callingCodeLen = callingCode.length + 1;
example = example.slice(callingCodeLen).trim();
return example.replace(/\d/g, "0");
}