decord/source/modules/routing/RouteUtils.tsx

44 lines
1.3 KiB
TypeScript
Raw Normal View History

// Module ID: 4477
// Function ID: 4478
// Name: RouteUtils
// Dependencies: [1075, 1965, 2, 4478]
2026-07-29 08:29:29 +00:00
// Exports: isPseudoGuildId, isValidChannelId, isValidGuildId
2026-07-20 16:05:17 +00:00
// Module 4477 (RouteUtils)
import RouteConstants from "RouteConstants" /* 1075 */;
import ChannelConstants from "ChannelConstants" /* 1965 */;
import RouteParam from "RouteParam" /* 4478 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
const PSEUDO_GUILD_IDS = RouteConstants.PSEUDO_GUILD_IDS;
const isStaticChannelRoute = ChannelConstants.isStaticChannelRoute;
2026-07-23 10:11:24 +00:00
const re2 = /^\d+$/;
const result = size.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;
export const isPseudoGuildId = function isPseudoGuildId(guildId) {
return PSEUDO_GUILD_IDS.includes(guildId);
2026-07-29 08:29:29 +00:00
};
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 = re2.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) {
let isMatch = re2.test(channelId);
2026-07-29 08:29:29 +00:00
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;
};