
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
A lightweight library to manage state + listen to state changes globally
npm i -s vnstore
import {vnstore} from 'vnstore'
const $items = vnstore()
import {vncontext, useContextHost, useProp} from 'vnstore'
const ctx = vncontext({count: 0})
const Parent = () => {
const {host, setProp} = useContextHost(ctx)
return host(
<div>
<Child />
</div>
)
}
const Child = () => {
const setProp = useSetProp(ctx)
const count = useProp(ctx, 'count')
return (
<div>
<span>{count}</span>
<button onClick={() => setProp('count', count + 1)} />
</div>
)
}
vnstore({
fetcher: () => [], // a function which will return a list of items (either sync or as a promise) to fetch a list of items
dependsOn: [], // a list of stores that when the selection changes will cause this store to be refreshed
lazy: true, // call the fetcher one when items are needed
})
/** fetcher example */
const $items = vnstore({
fetcher: () => fetchItemsAsync()
})
$items.refresh() // this will call fetchItemsAsync() and populate the store with it's response
/** lazy example */
const $items = vnstore({
fetcher: () => fetchItemsAsync(),
lazy: true
})
// fetchItemsAsync() not called yet
$items.list$(...)
// fetchItemsAsync() is called now
/** dependsOn example */
const $items = vnstore()
const $childrenItems = vnstore({
fetcher: () => fetchChildrenAsync(),
dependsOn: [$items]
})
$items.select('a')
// fetchChildrenAsync() is called
$items.select('b')
// fetchChildrenAsync() is called again
$items.loading() // false
$items.loading$(isLoading => ...)
$items.useLoading() // false
$items.refresh()
$items.loading() // true
$items.insert({id: 'a', prop1: 'abc', prop2: 'def'})
$items.insert([
{id: 'a', prop1: 'abc', prop2: 'def'},
{id: 'b', prop1: 'nice', prop2: 'one'}
])
$items.update('a', {prop1: 'ABC'})
$items.delete('a')
$items.select('a')
$items.size() // number
$items.list() // Item[]
$items.list(e => e.prop1 === 'qwerty') // Item[]
$items.map() // Map<string,Item>
$items.get('a') // Item | undefined
$items.selected() // Item | undefined
$items.list$(items => /* Item[] */)
$items.list$(e => e.prop1 === 'qwerty', items => /* Item[] */)
$items.map$(e => /* Map<string,Item> */)
$items.get$('a', e => /* Item | undefined */)
$items.selected$(e => /* Item | undefined */)
Hooks use listeners and will rerender component when items change
$items.useList() // Item[]
$items.useList(e => e.prop1 === 'qwerty') // Item[]
$items.useMap() // Map<string,Item>
$items.useGet('a') // Item | undefined
$items.useSelected() // Item | undefined
$items.reset()
$items.list() // []
FAQs
very nice store
The npm package vnstore receives a total of 0 weekly downloads. As such, vnstore popularity was classified as not popular.
We found that vnstore 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
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.