Skip to content
This repository has been archived by the owner on Jul 21, 2022. It is now read-only.
/ deno-url-pattern Public archive

⚡ An easy and simple approach for URL patterns in Deno

License

Notifications You must be signed in to change notification settings

ezarcel/deno-url-pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

URLPattern for Deno

An easy and simple approach for URL patterns in Deno. Inspired by snd's url-pattern.

Usage

import { URLPattern } from 'https://deno.land/x/url_pattern/mod.ts'

const pattern = new URLPattern('/book/:id')
pattern.match('/book/')              // >>> null
pattern.match('/book/123')           // >>> { id: '123' }

const pattern2 = new URLPattern('*') // This will accept everything
pattern.match('')                    // >>> {}
pattern.match('/')                   // >>> {}