New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resolveAsyncConfigs currently "resolves" every character of a string #610
Comments
Forget it, I did a wrong call to setModuleDefaults which caused the behaviour! Sorry. |
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! |
Please add a failing test to the test suite which covers this case and submit your proposed change as a PR. |
@flodaniel this bug may be of interest to you. |
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: