-
Notifications
You must be signed in to change notification settings - Fork 507
config.get returns a reference, instead of a copy #505
Description
Not sure if this is a bug or not, but the 'get' method call for a config value which is an object returns a reference rather than a copy.
This means that any changes to the returned config value, would update the config value - this behaviour not being expected for a READ method and is inconsistent with get calls for non object values.
What is the current behavior?
let value = config.get('test') -> where test is an object.
value.testKey = 'test'
console.log(config.get('test')) -> the config 'test' value has been updated with a new key: 'testKey'.
What is the expected behavior?
If a config value is an object, a copy of it should be returned, such that value.testKey does not affect subsequent calls to .get(). Instead of the user making a copy using Object.assign or something else, this is what I would expect .get to do.
Lib version:
^1.26.x