dset
dset copied to clipboard
Returning the modified object would simplify immutability
dset mutates the source object but doesn't return it. If the object was returned, we would get these advantages:
- would simplify the case of immutability: instead of having to create a wrapper (as suggested in this section in the README), we could simply do
modifiedObj = dset(klona(originalObj), keyPath, val) - would make
dsetmore aligned with it's cousinObject.assign, which "copies all enumerable own properties to a target object and returns the modified target object"
I'm happy to submit a PR if this is a desired feature.