@open-tech-world/route-matcher
v0.1.0
Published
A route pattern matcher using regular expressions.
Downloads
3
Maintainers
Readme
Route Matcher
⚡ by Open Tech World
A route pattern matcher using regular expressions.
Features
- Simple API
- Strict parsing (See parser rules)
- Supports named & unnamed parameters
- Supports custom regular experssions
- Parameters can be repeated or optional
Live Tester
https://route-matcher.pages.dev/tester
Installation
# With npm
$ npm install @open-tech-world/route-matcher
# With yarn
$ yarn add @open-tech-world/route-matcher
Usage
import { routeMatcher } from "@open-tech-world/route-matcher";
routeMatcher(route: string, path: string): RouteSegment[] | null;
// Eg: routeMatcher("/path/:param", "/path/value");
Documentation
Please read the complete documentation at: https://route-matcher.pages.dev/
License
Copyright (c) Thanga Ganapathy (MIT License).