feat: add DOMAIN_LABELS for chinese domain label (#322)

This commit is contained in:
Dream Hunter
2024-06-28 22:25:06 +08:00
committed by GitHub
parent de7c3d5176
commit 881e66e484
17 changed files with 1900 additions and 1659 deletions
+18
View File
@@ -79,6 +79,24 @@ export const getIntValue = (
return defaultValue;
}
export const getStringArray = (
value: string | string[] | undefined | null
): string[] => {
if (!value) {
return [];
}
// check if value is an array, if not use json.parse
if (!Array.isArray(value)) {
try {
return JSON.parse(value);
} catch (e) {
console.error("Failed to parse value", e);
return [];
}
}
return value;
}
export const getDomains = (c: Context<HonoCustomType>): string[] => {
if (!c.env.DOMAINS) {
return [];