Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@storeon/router
Advanced tools
Storeon Router which solves the problem of routing your application, providing full control over the route.
It size is 635 bytes (minified and gzipped) and uses Size Limit to control size.
npm install @storeon/router
# or
yarn add @storeon/router
If you want to use the router you should import the router.createRouter
from @storeon/router
and add this module to createStore
.
import createStore from 'storeon'
import router from '@storeon/router'
const store = createStore([
router.createRouter([
['/', () => ({ page: 'home' })],
['/blog', () => ({ page: 'blog' })],
['/blog/post/*', (id) => ({ page: 'post', id })],
[
/^blog\/post\/(\d+)\/(\d+)$/,
(year, month) => ({ page: 'post', year, month })
]
])
])
store.on(router.changed, (state, event) => {
if (!event.match) {
show404()
return
}
switch (event.match.page) {
case 'blog':
showBlog()
break
case 'post':
showPost({
id: event.match.id,
year: event.match.year,
month: event.match.month
})
break
default:
showHome()
}
})
store.dispatch(router.navigate, '/')
import router from '@storeon/router'
const moduleRouter = router.createRouter([
[path, callback]
])
Function router.createRouter
could have options:
router.key
– key for store.
router.navigate
– navigation action.
router.changed
– change event of pathname.
MIT
FAQs
Storeon module for URL routing
The npm package @storeon/router receives a total of 75 weekly downloads. As such, @storeon/router popularity was classified as not popular.
We found that @storeon/router demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.