New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

uritemplate

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uritemplate

An UriTemplate implementation of rfc 6570

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
40K
increased by8.23%
Maintainers
1
Weekly downloads
 
Created
Source

URI Template JS

This is a javascript implementation of RFC6570 - URI Template, and can expand templates up to and including Level 4 in that specification.

It exposes a constructor function UriTemplate with the two methods:

  • (static) parse(uriTemplateText) returning an instance of UriTemplate
  • expand(variables) returning an string

Requirements

You can use uritemplate.js in any even not so modern browser (Tested even with IE8 in IE7-Mode), see file demo.html. But you can also use it with node:

npm install uritemplate

and then:

var
    UriTemplate = require('uritemplate'),
    template;
template = UriTemplate.parse('{?query*}';
template.expand({query: {first: 1, second: 2}});
--> "?first=1&second=2"

If you want to clone the git project, be aware of the submodule uritemplate-test. So you have to to:

git https://github.com/fxa/uritemplate-js.git
git submodule init
git submodule update

Tests

The tests are taken from https://github.com/uri-templates/uritemplate-test as a submodule. Run the tests with

node test.js

Comming soon

  • A new method extract(uri), which tries to extract the variables from a given uri
  • Support of javascript's Date class

License

Copyright 2012 Franz Antesberger

MIT License, see http://mit-license.org/

Keywords

FAQs

Package last updated on 30 Jun 2012

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc