Commit 98e97e9a authored by fxa's avatar fxa

renamed source, added package.json, fixed number bug

parent 722a84ae
......@@ -12,15 +12,16 @@ It exposes a constructor function UriTemplate with the two methods:
Requirements
------------
You can use uri-template.js in any modern browsers (Tested even with IE8 in IE7-Mode), see file demo.html.
You can use uritemplate.js in any modern browsers (Tested even with IE8 in IE7-Mode), see file demo.html.
But you can also use it with node:
npm install git://www.github.com/fxa/uritemplate-js.git
var
UriTemplate = require('./path/to/uritemplate.js'),
template,
expanded;
UriTemplate = require('uritemplate'),
template;
template = UriTemplate.parse('{?query*}';
template.expand({query: {firstParam: "firstValue", secondParam: "secondValue"}});
template.expand({query: {first: 1, second: 2}});
--> "?firstParam=firstValue&secondParam=secondValue"
Tests
......@@ -34,7 +35,6 @@ Run the tests with
Comming soon
------------
* npm support with package.json
* npm support for npm install
* A new method extract(uri), which tries to extract the variables from a given uri
......
......@@ -2,7 +2,7 @@
<html>
<head>
<title>Demo of Usage</title>
<script type="text/javascript" src="src/uri-template.js"></script>
<script type="text/javascript" src="src/uritemplate.js"></script>
</head>
<body>
<div id="id"></div>
......@@ -13,8 +13,8 @@
templateText = "{?query*}",
variables = {
query: {
firstParam: "firstValue",
secondParam: "secondValue"
first: "1",
second: 2
}
};
document.getElementById('id').innerHTML =
......
{
"name" : "uritemplate",
"description" : "An UriTemplate implementation of rfc 6570",
"homepage" : "https://www.github.com/fxa/uritemplate-js",
"keywords" : ["util", "uri", "template", "rfc6570"],
"author" : "Franz Antesberger",
"contributors" : [],
"dependencies" : [],
"repository" : {"type": "git", "url": "git://github.com/fxa/uritemplate-js.git"},
"main" : "src/uritemplate.js",
"version" : "0.1.0"
}
\ No newline at end of file
/*jshint browser:true, bitwise:true, curly:true, devel: true, eqeqeq:true, forin:true, immed:true, latedef:true, newcap:true, noarg:true, nonew:true, undef:true */
/*global module */
(function (exportCallback) {
"use strict";
......@@ -65,8 +64,8 @@
}
return false;
}
if (typeof object === "string") {
// the empty string is considered as defined
if (typeof object === "string" || typeof object === "number" || typeof object === "boolean") {
// even the empty string is considered as defined
return true;
}
for (propertyName in object) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment