I’ve found another bug, in the readJSON operator, in the function getValue(key) function declaration.
The following “if / else” (used when you have a key containing some . separators) is not working to get “non object” results.
if (key.split('.').length > 1){
let foundObj = obj;
for (let thisKey of key.split('.')){
if (typeof foundObj[thisKey] == 'object'){
foundObj = foundObj[thisKey]
}
else {
return foundObj;
}
}
return foundObj;
}
Indeed, if the last item targeted by the key is not an object (so if typeof foundObj[thisKey] == 'object' is false), it’s the foundObj which is returned (which is the object from the previous iteration) instead of foundObj[thisKey].
So, in fact, I think you should do a return foundObj[thisKey]; here. (I think the return is here to interrupt the loop if you reached a non-object point ?).
1 Like