Skip to main content
Deno 2 is finally here πŸŽ‰οΈ
Learn more

URLPattern polyfill

This module is a polyfill implementing the URLPattern web API api in wasm and js. We use the crate rust-urlpattern from denoland which is the same as is used internally in the deno runtime.

The module works both in deno (for when the unstable flag is not passed as is the case until the deno api is stabilized) and in the browser.

Usage

Using URLPattern is as simple as:

import { URLPattern } from "https://deno.land/x/urlpattern/mod.ts";

const pattern = new URLPattern("/:some/:pattern", "https://example.com/some/pattern)

Or in case you want to automatically register the URLPattern object globally to the window object (in case it does not already exist):

import "https://deno.land/x/urlpattern/auto.ts";

const pattern = new URLPattern("/:some/:pattern", "https://example.com/some/pattern)

Maintainers

Other

Contribution

Pull request, issues and feedback are very welcome. Code style is formatted with deno fmt and commit messages are done following Conventional Commits spec.

Licence

Copyright 2021, the denosaurs team. All rights reserved. MIT license.