uri-template-lite
Advanced tools
Comparing version 0.1.3 to 0.1.4
24
index.js
@@ -5,4 +5,4 @@ | ||
/* | ||
* @version 0.1.3 | ||
* @date 2014-01-20 | ||
* @version 0.1.4 | ||
* @date 2014-05-03 | ||
* @stability 2 - Unstable | ||
@@ -18,3 +18,3 @@ * @author Lauri Rooden <lauri@rooden.ee> | ||
, RE = /\{([+#.\/;?&]?)((?:[\w%.]+(\*|:\d)?,?)+)\}/g | ||
, JOINERS = { | ||
, SEPARATORS = { | ||
'':",", '+':",", '#':"," //, ';':";" | ||
@@ -28,4 +28,4 @@ , '?':"&" //, '&':"&", '/':"/", '.':"." | ||
function addNamed(name, val, joiner) { | ||
return name + (val || joiner == "&" ? "=" : "") + val; | ||
function addNamed(name, val, sep) { | ||
return name + (val || sep == "&" ? "=" : "") + val; | ||
} | ||
@@ -40,5 +40,5 @@ | ||
return template.replace(RE, function(_, op, vals) { | ||
var joiner = JOINERS[op] || op | ||
, enc = op && joiner == "," ? encodeURI : encodeNormal | ||
, add = (joiner == ";" || joiner == "&") && addNamed | ||
var sep = SEPARATORS[op] || op | ||
, enc = op && sep == "," ? encodeURI : encodeNormal | ||
, add = (sep == ";" || sep == "&") && addNamed | ||
, out = mapCleanJoin(vals.split(","), function(name) { | ||
@@ -53,3 +53,3 @@ var exp = name != (name = name.split("*")[0]) | ||
if (Array.isArray(val)) { | ||
val = mapCleanJoin(val, enc, exp ? add ? joiner + name + "=" : joiner : "," ) | ||
val = mapCleanJoin(val, enc, exp ? add ? sep + name + "=" : sep : "," ) | ||
} | ||
@@ -60,3 +60,3 @@ else { | ||
return enc(key) + len + enc(val[key]) | ||
}, exp && (add || joiner == "/") ? joiner : "," ) | ||
}, exp && (add || sep == "/") ? sep : "," ) | ||
if (exp) add = null | ||
@@ -70,4 +70,4 @@ } | ||
return add ? add(name, val, joiner) : val | ||
}, joiner) | ||
return add ? add(name, val, sep) : val | ||
}, sep) | ||
@@ -74,0 +74,0 @@ return out ? (op!="+"?op+out:out) : out === "" && (op=="#"||op==".") ? op : "" |
{ | ||
"name": "uri-template-lite", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"stability": 2, | ||
@@ -20,6 +20,3 @@ "license": "MIT", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/litejs/uri-template-lite.git" | ||
}, | ||
"repository": "git://github.com/litejs/uri-template-lite.git", | ||
"bugs": { | ||
@@ -38,49 +35,25 @@ "url": "https://github.com/litejs/uri-template-lite/issues" | ||
"files": "tests/run.js", | ||
"browsers": { | ||
"ie": [ | ||
6, | ||
7, | ||
8, | ||
9, | ||
10 | ||
], | ||
"ff": [ | ||
3, | ||
4, | ||
5, | ||
20, | ||
25, | ||
"nightly" | ||
], | ||
"chrome": [ | ||
4, | ||
10, | ||
20, | ||
30, | ||
31, | ||
"canary" | ||
], | ||
"safari": [ | ||
4, | ||
5.1, | ||
6 | ||
], | ||
"opera": [ | ||
10, | ||
11, | ||
"11.6", | ||
12, | ||
"next" | ||
], | ||
"android-browser": [ | ||
4.2 | ||
], | ||
"iphone": [ | ||
6 | ||
], | ||
"ipad": [ | ||
6 | ||
] | ||
} | ||
"browsers": [ | ||
"ie/6..10", | ||
"ff/3", | ||
"ff/4", | ||
"ff/5", | ||
"ff/20", | ||
"ff/25", | ||
"chrome/4", | ||
"chrome/10", | ||
"chrome/20", | ||
"chrome/30", | ||
"chrome/31", | ||
"opera/10", | ||
"opera/11", | ||
"opera/11.6", | ||
"opera/12", | ||
"opera/16", | ||
"safari/4..6", | ||
"android-browser/4.2", | ||
"iphone/6", | ||
"ipad/6" | ||
] | ||
} | ||
} |
@@ -11,4 +11,4 @@ [1]: https://secure.travis-ci.org/litejs/uri-template-lite.png | ||
@version 0.1.3 | ||
@date 2014-01-20 | ||
@version 0.1.4 | ||
@date 2014-05-03 | ||
@stability 2 - Unstable | ||
@@ -15,0 +15,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
49392
1