Skip to content

larshisken/deno_uri_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Deno URI Template

A Typescript implementation of URI Template (RFC6570).

Usage

import { expand } from "https://deno.land/x/deno_uri_template/mod.ts";

expand("{hello}", { hello: "Hello World!" })
// "Hello%20World%21"

expand("{hello:6}", { hello: "Hello World!" })
// "Hello%20"

expand("{/path*}", { path: ["person", "albums" })
// "/person/albums"

expand("{?filter*}", { filter: { firstName: "john", lastName: "doe" } })
// "?firstName=john&lastName=doe"

Tests

$ git clone --recurse-submodules https://github.com/larshisken/deno_uri_template
$ deno test --allow-read