uri-template-lite
Advanced tools
Comparing version 0.0.2 to 0.0.3
19
index.js
@@ -5,3 +5,4 @@ | ||
/* | ||
* @version 0.0.2 | ||
* @version 0.0.3 | ||
* @date 2014-01-05 | ||
* @author Lauri Rooden - https://github.com/litejs/uri-template-lite | ||
@@ -29,8 +30,4 @@ * @license MIT License - http://lauri.rooden.ee/mit-license.txt | ||
function isString(s){ | ||
return typeof s == "string" | ||
} | ||
function mapCleanJoin(arr, mapFn, joinStr) { | ||
arr = arr.map(mapFn).filter(isString) | ||
arr = arr.map(mapFn).filter(function(s){return typeof s == "string"}) | ||
return arr.length && arr.join(joinStr) | ||
@@ -52,4 +49,4 @@ } | ||
if (Array.isArray(val)) { | ||
val=mapCleanJoin(val, enc, | ||
exp ? joiner + ((joiner == ";" || joiner == "&") ? name + "=" : "") : "," ) | ||
val = mapCleanJoin(val, enc, | ||
exp ? fn ? joiner + name + "=" : joiner : "," ) | ||
} | ||
@@ -59,4 +56,4 @@ else { | ||
val = mapCleanJoin(Object.keys(val), function(key){ | ||
return key in val && enc(key) + list_joiner + enc(val[key]) | ||
}, exp && (joiner == "/" || joiner == ";" || joiner == "&") ? joiner : "," ) | ||
return enc(key) + list_joiner + enc(val[key]) | ||
}, exp && (joiner == "/" || fn) ? joiner : "," ) | ||
if (exp) fn = null | ||
@@ -73,4 +70,2 @@ } | ||
//return (op!="+"&&out||((op == "#" || op == ".") && out == "")?op:"") + (out||"") | ||
return out ? (op!="+"?op+out:out) : out === "" && (op=="#"||op==".") ? op : "" | ||
@@ -77,0 +72,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!function(f){function m(d){return encodeURIComponent(d).replace(n,escape)}function p(d,b,a){return d+(b||"&"==a?"=":"")+b}function q(d){return"string"==typeof d}function k(d,b,a){d=d.map(b).filter(q);return d.length&&d.join(a)}function r(d,b,a,f){var e=s[a]||a,h=a&&","==e?encodeURI:m,l=(";"==e||"&"==e)&&p;return(b=k(f.split(","),function(a){var b=a!=(a=a.split("*")[0]),g=!b&&(g=a.split(":"),a=g[0],g[1]),c=d[a];if(null!=c){if("object"==typeof c){if(Array.isArray(c))c=k(c,h,b?e+(";"==e||"&"==e?a+"=": | ||
""):",");else{var f=b?"=":",",c=k(Object.keys(c),function(a){return a in c&&h(a)+f+h(c[a])},!b||"/"!=e&&";"!=e&&"&"!=e?",":e);b&&(l=null)}if(!c)return}else c=h(g?c.slice(0,g):c);return l?l(a,c,e):c}},e))?"+"!=a?a+b:b:""!==b||"#"!=a&&"."!=a?"":a}var n=/[\]\[:\/?#@!$&()*+,;=']/g,t=/\{([+#.\/;?&]?)((?:[\w%.]+(\*|:\d)?,?)+)\}/g,s={"":",","+":",","#":",","?":"&"};f.expand=function(d,b){return d.replace(t,r.bind(null,b))}}(this); | ||
!function(f){function m(c){return encodeURIComponent(c).replace(n,escape)}function p(c,b,a){return c+(b||"&"==a?"=":"")+b}function l(c,b,a){c=c.map(b).filter(function(c){return"string"==typeof c});return c.length&&c.join(a)}function q(c,b,a,f){var e=r[a]||a,k=a&&","==e?encodeURI:m,g=(";"==e||"&"==e)&&p;return(b=l(f.split(","),function(a){var b=a!=(a=a.split("*")[0]),h=!b&&(h=a.split(":"),a=h[0],h[1]),d=c[a];if(null!=d){if("object"==typeof d){if(Array.isArray(d))d=l(d,k,b?g?e+a+"=":e:",");else{var f= | ||
b?"=":",",d=l(Object.keys(d),function(a){return k(a)+f+k(d[a])},b&&("/"==e||g)?e:",");b&&(g=null)}if(!d)return}else d=k(h?d.slice(0,h):d);return g?g(a,d,e):d}},e))?"+"!=a?a+b:b:""!==b||"#"!=a&&"."!=a?"":a}var n=/[\]\[:\/?#@!$&()*+,;=']/g,s=/\{([+#.\/;?&]?)((?:[\w%.]+(\*|:\d)?,?)+)\}/g,r={"":",","+":",","#":",","?":"&"};f.expand=function(c,b){return c.replace(s,q.bind(null,b))}}(this); |
{ | ||
"name": "uri-template-lite", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "URI Templates.", |
@version 0.0.2 | ||
@version 0.0.3 | ||
@date 2014-01-05 | ||
@@ -5,0 +5,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
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
47491
913