Skip to content

Latest commit

 

History

History
28 lines (19 loc) · 654 Bytes

README.md

File metadata and controls

28 lines (19 loc) · 654 Bytes

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