decord/alpha/source/modules/phone/PhoneOrEmailUtils.tsx

34 lines
978 B
TypeScript
Raw Normal View History

// Module ID: 7294
// Function ID: 7295
// Name: PhoneOrEmailUtils
2026-07-23 10:11:24 +00:00
// Dependencies: [2]
2026-07-20 16:05:17 +00:00
// Exports: getPhoneOrEmail, shouldShowCountryCodeSelector
// Module 7294 (PhoneOrEmailUtils)
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
const PhoneOrEmailSelectorForceMode = { PHONE: "phone", EMAIL: "email" };
2026-07-23 10:11:24 +00:00
const re1 = /^[-() \d]+$/;
const result = size.fileFinishedImporting("modules/phone/PhoneOrEmailUtils.tsx");
2026-07-20 16:05:17 +00:00
export { PhoneOrEmailSelectorForceMode };
2026-07-20 16:05:17 +00:00
export const shouldShowCountryCodeSelector = function shouldShowCountryCodeSelector(forceMode, value) {
if (forceMode === obj.PHONE) {
let tmp2 = !value.startsWith("+");
} else {
2026-07-29 08:29:29 +00:00
tmp2 = forceMode !== tmp.EMAIL;
2026-07-20 16:05:17 +00:00
if (tmp2) {
2026-07-29 08:29:29 +00:00
let isMatch = value.length >= 3;
if (isMatch) {
isMatch = re1.test(value);
2026-07-20 16:05:17 +00:00
}
tmp2 = isMatch;
}
}
return tmp2;
};
export const getPhoneOrEmail = function getPhoneOrEmail(arg0) {
const obj = /^\+\d/;
2026-07-20 16:05:17 +00:00
return obj.test(arg0) ? obj.PHONE : obj.EMAIL;
};