32 lines
1 KiB
TypeScript
32 lines
1 KiB
TypeScript
// Module ID: 12894
|
|
// Function ID: 12895
|
|
// Name: FederatedSocialUtils
|
|
// Dependencies: [1085, 2]
|
|
// Exports: getExampleHandle, validateHandle
|
|
|
|
// Module 12894 (FederatedSocialUtils)
|
|
import Constants from "Constants" /* 1085 */;
|
|
import size from "module_2" /* 2 */;
|
|
|
|
const PlatformTypes = Constants.PlatformTypes;
|
|
const result = size.fileFinishedImporting("modules/connections/FederatedSocialUtils.tsx");
|
|
|
|
export const validateHandle = function validateHandle(arg0, platformType) {
|
|
if (platformType === PlatformTypes.MASTODON) {
|
|
const obj = /^@?[a-z0-9_]+([.-]+[a-z0-9_]+)*@[^@]+\.[^.@]{2,}$/i;
|
|
const isMatch = obj.test(arg0);
|
|
}
|
|
const obj2 = /^.+\.[^.@]{2,}$/;
|
|
return obj2.test(arg0);
|
|
};
|
|
export const getExampleHandle = function getExampleHandle(platformType) {
|
|
let str = "@example@mastodon.social";
|
|
if (platformType !== PlatformTypes.MASTODON) {
|
|
let str2 = "clyde@example.com";
|
|
if (platformType === PlatformTypes.BLUESKY) {
|
|
str2 = "example.bsky.social";
|
|
}
|
|
str = str2;
|
|
}
|
|
return str;
|
|
};
|