Skip to content

Commit

Permalink
renamed source, added package.json, fixed number bug
Browse files Browse the repository at this point in the history
  • Loading branch information
fxa committed Jun 10, 2012
1 parent 722a84a commit 98e97e9
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
6 changes: 3 additions & 3 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -13,8 +13,8 @@
templateText = "{?query*}",
variables = {
query: {
firstParam: "firstValue",
secondParam: "secondValue"
first: "1",
second: 2
}
};
document.getElementById('id').innerHTML =
Expand Down
12 changes: 12 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"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"
}
5 changes: 2 additions & 3 deletions src/uri-template.js → src/uritemplate.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/*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";

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 98e97e9

Please sign in to comment.