From da39734e1c2f1808371e4bf56509d7f1ef3da8c0 Mon Sep 17 00:00:00 2001 From: Kane Mason Date: Tue, 24 Nov 2020 16:56:45 +0200 Subject: [PATCH] Non nested array fields can be handled normally --- select.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/select.js b/select.js index 59ce122..eab6e1a 100644 --- a/select.js +++ b/select.js @@ -7,7 +7,8 @@ function convertRecur(fieldName, input, arrayFields, prefix, prefixStrip) { var entries = [] for (var key in input) { entries.push('\'' + key + '\'') - if (!arrayFields.includes(prefix + key)) { + const nestedArrayField = arrayFields.includes(prefix + key) && typeof input[key] === 'object' + if (!nestedArrayField) { entries.push(convertRecur(fieldName, input[key], arrayFields, prefix + key + '.' , prefixStrip)) } else { const path = util.pathToText([fieldName].concat((prefix + key).replace(new RegExp('^' + prefixStrip), '').split('.')), false)