# rfc6570-uri-template

> RFC 6570 URI Template Parser

Latest version **1.1.0** (published 2023-12-10) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install rfc6570-uri-template
pnpm add rfc6570-uri-template
yarn add rfc6570-uri-template
bun add rfc6570-uri-template
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2023-12-10 |
| First published | 2022-12-13 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 41.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Sergei Koshel |
| Maintainers | teil-one |
| Keywords | rfc6570, uri, url, template |

## Links

- npm: https://www.npmjs.com/package/rfc6570-uri-template
- Repository: https://github.com/teil-one/rfc6570-uri-template
- Homepage: https://github.com/teil-one/rfc6570-uri-template#readme
- Issues: https://github.com/teil-one/rfc6570-uri-template/issues
- npm.io page: https://npm.io/package/rfc6570-uri-template

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2023-12-10
- 1.0.0 — 2023-04-30
- 0.4.0 — 2023-04-27
- 0.3.1 — 2023-01-04
- 0.3.0 — 2023-01-04
- 0.2.0 — 2022-12-13
- 0.1.0 — 2022-12-13
- 0.0.1-security — 2022-12-13

## README

# rfc6570-uri-template

[RFC 6570](https://www.rfc-editor.org/rfc/rfc6570) URI template parser

## Getting started

```javascript
import { parse } from 'rfc6570-uri-template';

const template = parse('http://www.example.com/users/{id}');
const url = template.expand({ id: 1 }); // http://www.example.com/users/1
```

## Examples

`url = parse('{controller}/{action}').expand({ controller:  'books', action:  'read' });`\
books/read

`url = parse('foo{?query,number}').expand({ query:  'mycelium', number:  100 });`\
foo?query=mycelium&number=100

`url = parse('X{#hello}').expand({ hello:  'Hello World!' });`\
X#Hello%20World!

`url = parse('{+path:6}/here').expand({ path:  '/foo/bar' });`\
/foo/b/here

`url = parse('{list}').expand({ list: ['red', 'green', 'blue'] });`\
red,green,blue

`url = parse('{keys}').expand({ keys: { semi:  ';', dot:  '.', comma:  ',' } });`\
semi,%3B,dot,.,comma,%2C

`url = parse('{keys*}').expand({ keys: { semi:  ';', dot:  '.', comma:  ',' } });`\
semi=%3B,dot=.,comma=%2C

See more examples in the [RFC 6570 specification](https://www.rfc-editor.org/rfc/rfc6570).

[GitHub](https://github.com/teil-one/rfc6570-uri-template) · [NPM package](https://www.npmjs.com/package/rfc6570-uri-template)

---
_Source: https://npm.io/package/rfc6570-uri-template · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
