Skip to content

Commit 2a34a4d

Browse files
Added a check for an array for handling multi-field objects
Signed-off-by: Natalia Luzuriaga <natalia.luzuriaga@cms.hhs.gov>
1 parent 5c1892b commit 2a34a4d

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

js/formDataToJson.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ async function retrieveFile(filePath) {
1616

1717
function isMultiSelect(obj) {
1818
if (typeof obj !== 'object' || obj === null || Array.isArray(obj)) return false;
19-
2019
for (const key in obj) {
2120
if (typeof obj[key] !== 'boolean') {
2221
return false;
@@ -55,7 +54,7 @@ function populateObject(data, fields) {
5554
value = getSelectedOptions(value);
5655
}
5756
// Recurses if multi-field object
58-
else if (typeof value === 'object' && value !== null && Object.keys(value).length > 1) {
57+
else if (typeof value === 'object' && !Array.isArray(value) && value !== null && Object.keys(value).length > 1) {
5958
value = populateObject(value, Object.keys(value));
6059
}
6160

0 commit comments

Comments
 (0)