route-peek
v0.0.8
Published
Library for route pathname parsing
Downloads
519
Readme
🧱 Route Peek
The library for creating and matching dynamic routes.
Documentation
👉 Read the Route Peek docs
Prerequisites
- Node.js version 18 or higher.
Installation
You can install route-peek
using the JavaScript package manager:
npm add route-peek
Usage
import { PathPattern } from 'route-peek';
const pattern = new PathPattern('/users/{id:[0-9]+}');
console.log(pattern.test('/users/1234')); // true
console.log(pattern.exec('/users/1234')); // { id: '1234' }
License
MIT