Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
arrow-of-time
Advanced tools
Experiment with minimum possible composable implementation of a history (such as a Redux store, Act history, etc).
Experiment with minimum possible composable implementation of a history (such as a Redux store, Act history, etc).
To try it out, clone the repo and npm install
. Then npm start
and head to http://localhost:3000/demo/timeline.html
and http://localhost:3000/demo/snapshot.html
.
npm install --save-dev arrow-of-time
import getSnapshot, { subscribe } from 'arrow-of-time/snapshot'
const snapshot = getSnapshot((state, action) => {
switch (action.type) {
case 'item':
return {
...state,
items: [...state.items, action.payload]
}
case 'article':
return {
...state,
articles: [...state.articles, action.payload]
}
default:
state
}
}, { items: [], articles: [] })
const subscribedSnapshot = subscribe(({ getAction, getState }) => {
console.log('ACTION', getAction())
console.log('STATE', getState())
})(snapshot)
const snapshots = []
snapshots.push(subscribedSnapshot.getNext({ type: 'item', payload: 'home' }))
snapshots.push(snapshots[0].getNext({ type: 'item', payload: 'sea' }))
snapshots.push(snapshots[1].getNext({ type: 'item', payload: 'mountains' }))
import getTimeline, { subscribe } from 'arrow-of-time/timeline'
const timeline = getTimeline((state, action) => {
switch (action.type) {
case 'item':
return {
...state,
items: [...state.items, action.payload]
}
case 'article':
return {
...state,
articles: [...state.articles, action.payload]
}
default:
state
}
}, { items: [], articles: [] })
const subscribedTimeline = subscribe(({ getAction, getState }) => {
console.log('ACTION', getAction())
console.log('STATE', getState())
})(timeline)
const timelines = []
timelines.push(subscribedTimeline.getNext({ type: 'item', payload: 'home' }))
timelines.push(timelines[0].getNext({ type: 'item', payload: 'sea' }))
timelines.push(timelines[1].getNext({ type: 'item', payload: 'mountains' }))
timelines.push(timelines[2].rewind())
timelines.push(timelines[3].rewind())
timelines.push(timelines[4].redo())
import getStore from 'arrow-of-time/store'
const store = getStore((state, action) => {
switch (action.type) {
case 'item':
return {
...state,
items: [...state.items, action.payload]
}
case 'article':
return {
...state,
articles: [...state.articles, action.payload]
}
default:
state
}
}, { items: [], articles: [] })
store.subscribe(({ getAction, getState }) => {
console.log('ACTION', getAction())
console.log('STATE', getState())
})(timeline)
store.dispatch({ type: 'item', payload: 'home' }))
store.dispatch(timelines[0].getNext({ type: 'item', payload: 'sea' }))
store.dispatch(timelines[1].getNext({ type: 'item', payload: 'mountains' }))
store.update((timeline) => timeline.rewind())
store.update((timeline) => timeline.rewind())
store.update((timeline) => timeline.redo())
redoable
and rewindable
need to be the outermost higher order snapshots to be applied, because the way they work they will not play well in spreading the properties set by other higher order snapshots.FAQs
Experiment with minimum possible composable implementation of a history (such as a Redux store, Act history, etc).
The npm package arrow-of-time receives a total of 1 weekly downloads. As such, arrow-of-time popularity was classified as not popular.
We found that arrow-of-time 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
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.