You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently node-config will attempt to resolve of config objects, using it's build-in resolveAsyncConfigs function. The function recursively iterates over object properties and array elements, in order to resolve them deep. Unfortunately even immutable strings, are currently treated as normal objects, and as strings can be character-wise accessed using [0] to [string.length -1], this behaviour even works. However this causes a massive performance drawback when "cloning" large string instances, when a simple "copy" could be enough.
What is the expected behavior?
String should not be treated for resolving. So in the resolveAsyncFunction a "typeof prop !== "string"" check should be added.
Also (in case you are just at it), there is i think a small syntax error in the util.extendDeep function, see line 1248:
kristian
changed the title
extendDeep currently "clones" every character of a string
resolveAsyncConfigs currently "resolves" every character of a string
Jun 11, 2020
Reopenign this, as I now behave the same behavuiour in resolveAsyncConfigs, this one will check every character of a string ;) So please apply the above fix to this function instead. :) Thanks!
I'm submitting a ...
What is the current behavior?
Currently node-config will attempt to resolve of config objects, using it's build-in resolveAsyncConfigs function. The function recursively iterates over object properties and array elements, in order to resolve them deep. Unfortunately even immutable strings, are currently treated as normal objects, and as strings can be character-wise accessed using [0] to [string.length -1], this behaviour even works. However this causes a massive performance drawback when "cloning" large string instances, when a simple "copy" could be enough.
What is the expected behavior?
String should not be treated for resolving. So in the resolveAsyncFunction a "typeof prop !== "string"" check should be added.
Also (in case you are just at it), there is i think a small syntax error in the util.extendDeep function, see line 1248:
There is a "else" missing in this line! So I think it would be to change the if into:
Please tell us about your environment:
Other information
(e.g. are you using an environment besides Node.js?)
The text was updated successfully, but these errors were encountered: