The library for creating and matching dynamic routes.
👉 Read the Route Peek docs
- Node.js version 18 or higher.
You can install route-peek
using the JavaScript package manager:
npm add route-peek
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' }
MIT