no mutation

This commit is contained in:
jaydenfyi 2026-01-25 10:46:24 +08:00
parent 7d11bf8adb
commit cad8c92128

View File

@ -45,17 +45,18 @@ function readStringParam(
} }
// Convert value to string safely // Convert value to string safely
let str: string;
if (typeof value === "string") { if (typeof value === "string") {
str = value; return options.trim !== false ? value.trim() : value;
} else if (typeof value === "number" || typeof value === "boolean") {
str = String(value);
} else {
throw new Error(`Parameter ${key} must be a string, number, or boolean`);
} }
if (typeof value === "number" || typeof value === "boolean") {
const str = String(value);
return options.trim !== false ? str.trim() : str; return options.trim !== false ? str.trim() : str;
} }
throw new Error(`Parameter ${key} must be a string, number, or boolean`);
}
/** Supported Twitch actions */ /** Supported Twitch actions */
const TWITCH_ACTIONS = new Set(["send" as const]); const TWITCH_ACTIONS = new Set(["send" as const]);
type TwitchAction = typeof TWITCH_ACTIONS extends Set<infer U> ? U : never; type TwitchAction = typeof TWITCH_ACTIONS extends Set<infer U> ? U : never;