refactor(plugin-sdk): share boolean action param parsing

This commit is contained in:
Peter Steinberger
2026-03-02 14:35:40 +00:00
parent 693f61404d
commit 741e74972b
4 changed files with 23 additions and 36 deletions

View File

@@ -0,0 +1,19 @@
export function readBooleanParam(
params: Record<string, unknown>,
key: string,
): boolean | undefined {
const raw = params[key];
if (typeof raw === "boolean") {
return raw;
}
if (typeof raw === "string") {
const trimmed = raw.trim().toLowerCase();
if (trimmed === "true") {
return true;
}
if (trimmed === "false") {
return false;
}
}
return undefined;
}