@open-tech-world/route-matcher
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

Route Matcher

by Open Tech World

Build npm bundle size (scoped version)

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).

Package Sidebar

Install

npm i @open-tech-world/route-matcher

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

33.8 kB

Total Files

8

Last publish

Collaborators

  • ganapathy