
Security News
New CVE Forecasting Tool Predicts 47,000 Disclosures in 2025
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
multi-path-matcher
Advanced tools
finds and decodes best matching path in a set of routes
With paramus
import { compile, matcher } from "multi-path-matcher";
const routes = [
{ path: "/a/b/c" },
{ path: "/a/b" },
{ path: "/d/:att1/e/:att2" },
{ path: "/d/:att1/e" },
{ path: "/" }
];
const compiled = compile(routes);
matcher(compiled "/a"); // undefined
matcher(compiled, "/a/b"); // routes[1]
matcher(compiled, "/a/b/c"); // routes[0]
matcher(compiled, "/d/value1/e"); // routes[3] { att1: "value1" }
matcher(compiled, "/d/value1/e/value2"); // routes[2] { att1: "value1", att2: "value2" }
matcher(compiled, "/"); // routes[4]
With wildcards
import { compile, matcher } from "multi-path-matcher";
const routes = [
{ path: "/" },
{ path: "/*" },
{ path: "/about"},
{ path: "/login" }
];
const compiled = compile(routes);
matcher(compiled "/"); // routes[0]
matcher(compiled "/index.html"); // routes[1]
matcher(compiled "/about"); // routes[2]
matcher(compiled "/login"); // routes[3]
Result of the routes compilation
Type: Object
One single route
Type: Object
path
stringResult of a match
Type: Object
route
Route? as given to the compiler, undefined if no matching route foundparams
Object extracted from the pathCompile a set of routes
Returns CompiledRoutes
Result of a path compilation priorities for each path component
Type: Object
regex
RegExp for later checking and params extrationkeys
Set<string> all keys found in the routepriority
number order in which to checkGenerate regex with priority
path
stringReturns CompiledRoute
Find best match for a given path
compiled
CompiledRoutespath
stringReturns Match match
With npm do:
npm install multi-path-matcher
BSD-2-Clause
FAQs
Finds and decodes best matching path in a set of routes
The npm package multi-path-matcher receives a total of 54 weekly downloads. As such, multi-path-matcher popularity was classified as not popular.
We found that multi-path-matcher 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.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.