
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
@nano-router/router
Advanced tools
A framework agnostic minimalistic router with a focus on named routes.
This package is meant as a basis for creating framework specific routers like the React integration.
npm install @nano-router/history @nano-router/router
import {
createBrowserHistory,
createMemoryHistory,
} from "@nano-router/history";
const browserHistory = createBrowserHistory();
// or
const memoryHistory = createMemoryHistory();
import { Routes, Route } from "@nano-router/router";
const routes = new Routes(
new Route("posts/new", "/posts/new"),
new Route("posts/edit", "/posts/:id"),
new Route("posts", "/posts"),
);
See @nano-router/routes for more information about the route configuration.
const router = new Router({ routes, history: browserHistory });
router.listen(() => {
// routing has been updated
});
See history.listen(...) for more information.
router.navigate({ route: "posts/edit", params: { id: 42 } });
const routeName = router.route;
const { pathname, hash, search, state } = router.location;
const { id } = router.params;
Copyright (c) 2020 Sune Simonsen mailto:sune@we-knowhow.dk
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
FAQs
The nano-router
The npm package @nano-router/router receives a total of 518 weekly downloads. As such, @nano-router/router popularity was classified as not popular.
We found that @nano-router/router demonstrated a healthy version release cadence and project activity because the last version was released less than 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.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.