Collect and Aggregate All Form Input Values into a Single Object
Write a JavaScript function or utility that traverses a given HTML form element and collects the values of all its input fields (text, checkbox, radio, select, textarea) into a single key-value object where keys are the input names. Handle grouped inputs like checkboxes with the same name (collect as array), radio buttons (pick selected value), and nested field names using dot notation. Widely used in custom form libraries and low-code builders.