-
Notifications
You must be signed in to change notification settings - Fork 507
[BUG] Incorrect/ambiguous docs for config.util.toObject() #890
Description
Describe the bug
The documentation for the config.util.toObject() states the following:
Returns a new deep copy of the current config object, or any part of the config if provided.
But looking at both the implementation and the type definition, this value must always be provided.
I would expect that this doc was never updated to reflect the changes to the internals of config.util in 4.2.0, as before that version this argument would indeed have been optional.
Expected behavior
I would either expect the documentation to not imply that the value is optional or for the implementation to support the old optionality of this argument.
Looking at the implementation it might also be the case that if you call it as config.util.toObject(config) in an attempt to get the old behaviour, the get/has/util/etc. fields will be included in the output. But maybe this was already the case with the old behaviour and I just never noticed.
Please tell us about your environment:
- node-config version: 4.4.0 (upgrading from 4.1.0)
- node-version: 24