0.1.0 • Published 2 years ago

@open-tech-world/route-matcher v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

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