Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Manipulate JavaScript Object with immer
is very easy, but it's hard to manipulate a deep-nested Object.
For example, a <Component />
may handle a state object in the tree.
root
/ \
/ \
2 \
/ \ 3
4 5 / \
9 \
obj <--- `<Component />` render and update this
/ \
6 7
The problem is:
obj
in root
?obj
?If <Component />
hold the obj
object, we can find it in root
tree and update it, but can not get next obj
in next root
.
So the solution is give every object a $$path
, <Component />
hold $$path
of obj
, and update & get next value with $$path
.
import {
initPath,
producePath,
findByPath,
} from 'immer-path';
const target = {
hey: {
yes: 'hello',
},
};
// init
const targetPath = initPath(target);
// get path, <Component /> hold this
const nodePath = targetPath.hey.$$path;
const nextData = producePath(targetPath, (draft) => {
// find obj with path
const node = findByPath(draft, nodePath) as any;
// update it
node.yes = 'yes';
});
FAQs
## Why
The npm package immer-path receives a total of 3 weekly downloads. As such, immer-path popularity was classified as not popular.
We found that immer-path demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.