import { RequestUrl } from "dreamkit";
Class inherited from URL but with strongly typed is method.
is
It can also be consumed by middlewares and APIs.
class RequestUrl extends URL { is(...paths: string[]): boolean;}
import { $middleware, $route, Link, RequestUrl, s } from "dreamkit"; export class MyMiddleware extends $middleware.self({ RequestUrl }).create() { onRequest() { if (this.requestUrl.is("/user/:id")) { console.log("User route!"); } }}export const userRoute = $route .params({ id: s.number() }) .path(({ id }) => `/user/${id}`) .create(({ params }) => <>id: {params.id}</>); export default $route.path("/").create(() => { return ( <Link href="/user/:id" params={{ id: 1 }}> User 1 </Link> );});