collectParamsFromUI function presentation
Last updated: 2026-03-04T23:21:38.396Z
Metrics
LOC: 46
Complexity: 15
Params: 0
Signature
collectParamsFromUI(): : GeneratorParams | undefined
Architecture violations
- [warning] max-cyclomatic-complexity: 'collectParamsFromUI' has cyclomatic complexity 15 (max 10)
Source Code
function collectParamsFromUI(): GeneratorParams | undefined {
if (!rulePopupElement) return undefined;
const container =
rulePopupElement.querySelector<HTMLElement>("#fa-rp-params");
if (!container || container.style.display === "none") return undefined;
const inputs = container.querySelectorAll<HTMLInputElement>(
"input[data-param-key]",
);
const selects = container.querySelectorAll<HTMLSelectElement>(
"select[data-param-key]",
);
if (inputs.length === 0 && selects.length === 0) return undefined;
const params: Record<string, unknown> = {};
let hasAny = false;
inputs.forEach((input) => {
const key = input.dataset.paramKey!;
if (input.type === "checkbox") {
params[key] = input.checked;
hasAny = true;
} else if (input.type === "number") {
const val = parseFloat(input.value);
if (!isNaN(val)) {
params[key] = val;
hasAny = true;
}
} else if (input.type === "text") {
if (input.value !== "") {
params[key] = input.value;
hasAny = true;
}
}
});
selects.forEach((select) => {
const key = select.dataset.paramKey!;
if (select.value) {
params[key] = select.value;
hasAny = true;
}
});
return hasAny ? (params as GeneratorParams) : undefined;
}
No outgoing dependencies.
Impact (Incoming)
| Source | Type |
|---|---|
| updatePreview | calls |
| saveFieldRule | calls |