A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/fxa/uritemplate-js below:

fxa/uritemplate-js: An javascript implementation of RFC6570 Uri Templates

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:

Be aware, that a parsed UriTemplate is frozen, so it is stateless. You can reuse instances of UriTemplates.

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 in a node application:

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

or within a html document (see also demo.html):

<script type="text/javascript" src="bin/uritemplate.js"></script>
<script type="text/javascript">
    var template = UriTemplate.parse('{?query*}');
    alert(template.expand({query: {first: 1, second: 2}}));
</script>

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

git clone --recursive https://github.com/fxa/uritemplate-js.git

The integration tests are taken from https://github.com/uri-templates/uritemplate-test as a submodule. The tests are integrated in the Jakefile.

Copyright 2013 Franz Antesberger

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


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4