
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
A small, unopinionated client-side routing library.
Even though the Contexts in this example are just Strings, any value can be a Context - the most useful of which are JavaScript Objects.
var onContextChanged = function (from, to, params) {
console.log(from, '->', to, params);
};
var router = new cartier(onContextChanged);
var HomeContext = 'home',
CollectionContext = 'collection',
DrilldownContext = 'drilldown',
NotFoundContext = 'error';
var routes = {
'/home': HomeContext,
'/:collection': CollectionContext,
'/:collection/:id': DrilldownContext
};
/* Set up the 404 context. */
router.setNotFoundContext(NotFoundContext);
/* Add the routes and start routing. */
router.route(routes);
router.navigate('/tests');
// => home -> collection Object {collection: "tests"}
router.navigate('/tests/123');
// => collection -> drilldown Object {collection: "tests", id: "123"}
And then in your HTML documents:
<a href="#!/tests">Click Here!</a>
<a href="#!/tests/123">(Or Here)</a>
Note that the #! will not appear in the URL - this is just Cartier's chosen method of intercepting routes without leaving the page.
After cloning this repo, grab all of the dependencies like so:
$ npm i
But wait! There's more! You'll also need to install the tools that Cartier uses for testing:
$ npm i -g gulp istanbul mocha-phantomjs phantomjs
mocha-phantomjs is used for running the tests in PhantomJS and displaying the results in the console easily.
Phew!
Now that all of the setup is out of the way, run npm test or gulp test from the folder you cloned Cartier into.
You can view the full coverage report or run the tests in a browser by navigating to the URLs indicated in the console.
Please note that the test task never terminates. It continues to serve the test runner and coverage results until it is explicitly closed (using Ctrl+C or the like).
Cartier currently relies on window.history.pushState(), so if compatibility is a major issue for you, Cartier may not be for you.
Also, currently only one callback for context switches is supported - although that callback can be used to trigger events.
Cartier may be freely distributed under the MIT license.
FAQs
A small, unopinionated client-side router.
We found that cartier 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
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.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.