
Research
Security News
Lazarus Strikes npm Again with New Wave of Malicious Packages
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
@erickmerchant/framework
Advanced tools
This scoped package is my personal framework. I use it on a number of small projects.
This example uses yo-yo (which uses hyperx), but you should be able to use diffHTML and possibly other solutions.
const framework = require('@erickmerchant/framework')
const html = require('yo-yo')
const diff = html.update
const target = document.querySelector('main')
framework({target, store, component, diff})()
function store (seed) {
seed(0)
return function (commit, action) {
switch (action) {
case 'increment': commit((state) => state + 1)
case 'decrement': commit((state) => state - 1)
}
}
}
function component ({state, dispatch}) {
return html`<main>
<output>${state}</output>
<br>
<button onclick=${decrement}>--</button>
<button onclick=${increment}>++</button>
</main>`
function decrement () {
dispatch('decrement')
}
function increment () {
dispatch('increment')
}
}
framework({target, store, component, diff, raf})
The function exported by this module.
Returns a function. See init
This is what is initially passed to seed and subsequently returned from commit callbacks. It can be anything from simply a number like in the example, to a complex object.
seed(state)
It should be passed the initial state
commit((current) => next)
It's passed a callback that receives the current state and should return the new state.
dispatch(...arguments)
Initializes a change in state and causes a render
next(({target, dispatch}) => { ... })
A convenient helper to pass a callback to process.nextTick. Can be used to manipulate the page in some way after a render. For example scrolling to a specific element
init(({target, dispatch}) => { ... })
Call init to mount your component. The callback is optional.
store(seed)
It should return the agent.
agent(commit, ...arguments)
Anything returned will be ignored
component({state, dispatch, next})
Should return the element to pass to diff
diff(target, element)
A module to create a store from other stores where each is responsible for one property in the state. Does not currently work with 12.
A module to do routing inside your components.
The source code can be found here
FAQs
A front-end framework.
We found that @erickmerchant/framework 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
The Socket Research Team has discovered six new malicious npm packages linked to North Korea’s Lazarus Group, designed to steal credentials and deploy backdoors.
Security News
Socket CEO Feross Aboukhadijeh discusses the open web, open source security, and how Socket tackles software supply chain attacks on The Pair Program podcast.
Security News
Opengrep continues building momentum with the alpha release of its Playground tool, demonstrating the project's rapid evolution just two months after its initial launch.