New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

uri-template.js

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uri-template.js

Node/Javascript URI Template (RFC 6570) that supports both expansion & extraction

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

uri-template.js

Build Status

Node.js/Javascript RFC 6570 URI Template implementation that supports both URI expansion and extraction.

Usage

Expansion

A very simple usage

UriTemplate.expand('/{username}/profile', {'username': 'john'});

>> '/john/profile'

More examples (supports all expansion levels defined in RFC6570)

UriTemplate.expand('/search/{term:1}/{term}/{?q*,limit}', {
    term: 'john',
    q: ['a', 'b'],
    limit: 10,
});

>> '/search/j/john/?q=a,b&limit=10'

Extraction

Extract variables from URI.

UriTemplate.extract('/search/{term:1}/{term}/{?q*,limit}', '/search/j/john/?q=a&q=b&limit=10');

>>
(
    'term:1': 'j',
    term: 'john',
    q: [
      'a',
      'b'
    ]
    limit: 10
)

Installation

In browsers:

bower install uri-template.js
<script src="dist/uri-template.js"></script>
UriTemplate.expand(...)

In Node.js

npm install uri-template.js

UriTemplate = require('uri-template.js');

Keywords

library

FAQs

Package last updated on 07 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts