lukeed / lukeed/dset

Returning the modified object would simplify immutability

Open
#39 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.