You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

18 lines
480 B

import { KnownConfigKey } from "./registry";
const TRIMMABLE_GLOBAL_CONFIG_KEYS = new Set<KnownConfigKey>([
"commentMailFromEmail",
"commentSmtpHost",
"commentSmtpUser",
"commentSmtpPass",
]);
export function normalizeGlobalConfigValue<K extends KnownConfigKey>(key: K, value: unknown): unknown {
if (typeof value !== "string") {
return value;
}
if (key === "siteName" || TRIMMABLE_GLOBAL_CONFIG_KEYS.has(key)) {
return value.trim();
}
return value;
}