
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
cool-store
Advanced tools
CoolStore is a simple and powerful state store built on top of ImmerJS and RxJS
CoolStore is an immutable state store built on top of ImmerJS and RxJS.
Hit the Star button if you love this project ⭐️
npm install --save cool-store rxjs
CoolStore
?import { CoolStore } from 'cool-store';
interface User {
name: string;
email: string;
}
const initialState: User = {
name: null,
email: null,
};
const store = new CoolStore(initialState);
store.set(state => {
state.name = 'Vien Dinh';
state.email = 'vien@test.com';
});
const state = store.get();
console.log({ user: state });
store.getChanges()
observable.store.getChanges().subscribe(state => {
console.log({ user: state });
});
store.reset();
store.set()
method.store.set({
name: 'Vien Dinh',
email: 'vien@test.com',
});
store.set(() => ({
name: 'Vien Dinh',
email: 'vien@test.com',
}));
store.set(state => {
state.name = 'Vien Dinh';
});
AsyncCoolStore
?import { AsyncCoolStore, AsyncCoolState } from 'cool-store';
interface User {
name: string;
email: string;
}
const initialState: AsyncCoolState<User, Error> = {
loading: false,
data: null,
error: null,
};
const store = new AsyncCoolStore(initialState);
function getUser(id: number) {
store.setLoading();
fetch('https://jsonplaceholder.typicode.com/users/' + id)
.then(res => res.json())
.then(data => store.setData(data))
.catch(error => store.setError(error));
}
getUser(1); // execute the function
store.getChanges()
observable.store.getChanges().subscribe(({ loading, data, error }) => {
console.log({ loading, data, error });
});
You can also use store.get()
, store.set()
, store.reset()
methods with AsyncCoolStore
.
store.setData()
method.store.setData({
name: 'Vien Dinh',
email: 'vien@test.com',
});
store.setData(() => ({
name: 'Vien Dinh',
email: 'vien@test.com',
}));
store.setData(state => {
state.name = 'Vien Dinh';
});
FAQs
CoolStore is a simple and powerful state store built on top of ImmerJS and RxJS
The npm package cool-store receives a total of 0 weekly downloads. As such, cool-store popularity was classified as not popular.
We found that cool-store 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
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.