decord/source/modules/routing/RouteUtils.tsx

44 lines
1.2 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 4220
// Function ID: 4221
2026-07-29 08:29:29 +00:00
// Name: RouteParam
2026-08-25 06:04:03 +00:00
// Dependencies: [677, 1398, 2, 4221]
2026-07-29 08:29:29 +00:00
// Exports: isPseudoGuildId, isValidChannelId, isValidGuildId
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 4220 (RouteParam)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
import INVITE from "INVITE" /* 677 */;
import set2 from "set" /* 1398 */;
2026-08-25 06:04:03 +00:00
import RouteParam from "RouteParam" /* 4221 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
const PSEUDO_GUILD_IDS = INVITE.PSEUDO_GUILD_IDS;
const isStaticChannelRoute = set2.isStaticChannelRoute;
2026-07-23 10:11:24 +00:00
const re2 = /^\d+$/;
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/routing/RouteUtils.tsx");
2026-07-20 16:05:17 +00:00
2026-08-24 06:08:38 +00:00
export const RouteParam = RouteParam.RouteParam;
2026-07-29 08:29:29 +00:00
export const isPseudoGuildId = function isPseudoGuildId(stateFromStores) {
return PSEUDO_GUILD_IDS.includes(stateFromStores);
};
2026-07-20 16:05:17 +00:00
export const isValidGuildId = function isValidGuildId(guildId) {
let tmp = null != guildId;
if (tmp) {
2026-07-29 08:29:29 +00:00
let hasItem = PSEUDO_GUILD_IDS.includes(guildId);
if (!hasItem) {
hasItem = regex.test(guildId);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = hasItem;
2026-07-20 16:05:17 +00:00
}
return tmp;
};
export const isValidChannelId = function isValidChannelId(channelId) {
let tmp = null == channelId;
if (!tmp) {
2026-07-29 08:29:29 +00:00
let isMatch = regex.test(channelId);
if (!isMatch) {
isMatch = isStaticChannelRoute(channelId);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp = isMatch;
2026-07-20 16:05:17 +00:00
}
return tmp;
};