
Research
Security News
Malicious PyPI Package Exploits Deezer API for Coordinated Music Piracy
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Make your models observable. Nothing more nothing less. However, the interesting part of Mvstate lies in how this is done. It's using the functor concept from functional programming to achieve this.
Make your models observable. Nothing more nothing less. However, the interesting part of Mvstate lies in how this is done. It's using the functor concept from functional programming to achieve this.
Mvstate allows you to wrap your model, and then lift your normal functions to operate on your wrapped model. This means that your functions stay completely ignorant of all the observable magic. Let's have a look:
// Model
const create = () => ({counter: 0});
const inc = ({counter}) => ({counter: counter + 1});
const dec = ({counter}) => ({counter: counter - 1});
// Now wrap you model in an Observable
const observable = mkObservable(Model.create())
// Observe it
observe(observable, (newObservable) => {
console.log('value is', getModel(newObservable).counter);
})
// Operate on your observable. Note: functor laws are obeyed to avoid nasty surprises!
const newObservable = fmap(inc, observable);
// When you want, notify all observers that your observable changed.
notify(newObservable); // "value is 1" will be logged.
If you look at the above example and get scared or confused, don't worry! This is the core code, it is not how you are intended to use it. Just notice that the three lines that make up the model are very simple and ignorant of any observable behavior.
Have a look at the React examples for how it is used in real life. It's pretty fancy!
To sum up, Mvstate allows you to make your models observable. But while coding your models, you can completely ignore that they are observable. No need to mess with state. No need to keep track of a list of observers. Just code your elegant pure code operating on immutable models. Mvstate isn't solving a hard problem, but it can help you produce better and more maintainable code. Try it out and join me in the quest of raising the quality of code!
Cheers, Peter Crona
FAQs
Make your models observable. Nothing more nothing less. However, the interesting part of Mvstate lies in how this is done. It's using the functor concept from functional programming to achieve this.
We found that localstate 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.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.
Security News
Newly introduced telemetry in devenv 1.4 sparked a backlash over privacy concerns, leading to the removal of its AI-powered feature after strong community pushback.