no mutation

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

View File

@ -45,15 +45,16 @@ 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`);
} }
return options.trim !== false ? str.trim() : str;
if (typeof value === "number" || typeof value === "boolean") {
const str = String(value);
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 */