JacobLinCool / JacobLinCool/controlled-fs
Support Partial Update for JSON Files
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
I noticed that currently the only way to perform a partial update on an object is by using the spread operator, as shown in the following example:
```ts
fs[id].info.$data = { ...fs[id].info.$data, somekey: fs[id].info.$data.somekey + 1 };
```
While this method works, it has the downside of incurring I/O overhead if cache is disabled, and it might not be as readable as some other alternatives.
I suggest adding the possibility of performing partial updates using the following syntax:
```ts
fs[id].info.$data.somekey += 1;
```
This would make the process of performing partial updates easier and more intuitive.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by tracing the TypeScript API that exposes fs[id].info.$data and how JSON writes are triggered; the issue provides no file or test names. Compare the requested nested mutation syntax with the current spread-based update and define tests for correctness and cache-disabled I/O before implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100