UNPKG

uritemplate

Version:

An UriTemplate implementation of rfc 6570

31 lines (30 loc) 1.18 kB
<!DOCTYPE html> <html> <head> <title>Demo of Usage</title> <script type="text/javascript" src="bin/uritemplate.js"></script> </head> <body> <div id="id"></div> <script type="text/javascript"> (function () { "use strict"; var templateText = "{?query*}", variables = { query: { first: "1", second: 2 } }, expanded = UriTemplate.parse(templateText).expand(variables); document.getElementById('id').innerHTML = "<p>When you have a template of the form</p><p><code>var templateText = \"" + templateText + "\";</code></p><p>and params of the form </p><p><code>var variables = {query: {first: \"1\", second: 2}}" + ";</code></p><p>, you can use </p><p><code>UriTemplate.parse(templateText).expand(variables); </code></p><p>to produce </p><p><code>" + expanded + "</code></p><p> Look at the source code of this page!</p>"; }()); </script> </body> </html>