captureFormValues function exported
Last updated: 2026-03-04T23:21:38.398Z
Location
Metrics
LOC: 32
Complexity: 14
Params: 0
Signature
captureFormValues(): : Promise<Record<string, string>>
Summary
Captures current form values and returns them as a map
Architecture violations
- [warning] max-cyclomatic-complexity: 'captureFormValues' has cyclomatic complexity 14 (max 10)
Source Code
export async function captureFormValues(): Promise<Record<string, string>> {
const { fields } = await detectAllFieldsAsync();
const values: Record<string, string> = {};
for (const field of fields) {
const el = field.element;
const key = field.id || field.name || field.selector;
// if this field came from a custom adapter try to extract its value
if (field.adapterName) {
const custom = extractCustomComponentValue(field);
if (custom !== null) {
values[key] = custom;
continue;
}
}
if (el instanceof HTMLSelectElement) {
values[key] = el.value;
} else if (el instanceof HTMLInputElement) {
if (el.type === "checkbox" || el.type === "radio") {
values[key] = el.checked ? "true" : "false";
} else {
values[key] = el.value;
}
} else {
values[key] = (el as HTMLTextAreaElement).value;
}
}
return values;
}
Dependencies (Outgoing)
| Target | Type |
|---|---|
| detectAllFieldsAsync | calls |
| extractCustomComponentValue | calls |
Impact (Incoming)
| Source | Type |
|---|---|
| FillableElement | uses |
| makeInput | uses |