dset icon indicating copy to clipboard operation
dset copied to clipboard

Returning the modified object would simplify immutability

Open paulovieira opened this issue 3 years ago • 0 comments

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 dset more aligned with it's cousin Object.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.

paulovieira avatar Jun 28 '22 10:06 paulovieira