diff --git a/lib/core/utils.js b/lib/core/utils.js index 9c215c7fdc..445dead72e 100644 --- a/lib/core/utils.js +++ b/lib/core/utils.js @@ -20,18 +20,19 @@ function convertObject(obj, ignore) { function convertValue(key, value, ignore) { if (is.nullOrUndefined(value)) return value; - let hit; + let hit = false; for (const matchKey of ignore) { if (is.string(matchKey) && matchKey === key) { hit = true; + break; } else if (is.regExp(matchKey) && matchKey.test(key)) { hit = true; + break; } } if (!hit) { if (is.symbol(value) || is.regExp(value)) return value.toString(); - if (is.primitive(value)) return value; - if (is.array(value)) return value; + if (is.primitive(value) || is.array(value)) return value; } // only convert recursively when it's a plain object,