Returning the modified object would simplify immutability
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 783
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
`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](https://github.com/lukeed/dset#immutability)), we could simply do `modifiedObj = dset(klona(originalObj), keyPath, val)`
- would make `dset` more aligned with it's cousin [`Object.assign`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the README's immutability section and inspect the dset entry point to confirm its current return behavior. Done means dset returns the modified target object, allowing the klona-based example and matching the cited Object.assign behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100