universal-router
Advanced tools
Comparing version 9.2.0 to 9.2.1
@@ -73,3 +73,3 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
if (typeof token !== 'string') { | ||
if (token && typeof token !== 'string') { | ||
keys[token.name] = true; | ||
@@ -96,4 +96,6 @@ } | ||
if (!regexp.keys[key]) { | ||
queryParams[key] = params[key]; | ||
if (key && !regexp.keys[key]) { | ||
var _params$key; | ||
queryParams[key] = (_params$key = params[key]) != null ? _params$key : ''; | ||
} | ||
@@ -100,0 +102,0 @@ } |
@@ -71,3 +71,3 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
if (typeof token !== 'string') { | ||
if (token && typeof token !== 'string') { | ||
keys[token.name] = true; | ||
@@ -94,4 +94,6 @@ } | ||
if (!regexp.keys[key]) { | ||
queryParams[key] = params[key]; | ||
if (key && !regexp.keys[key]) { | ||
var _params$key; | ||
queryParams[key] = (_params$key = params[key]) != null ? _params$key : ''; | ||
} | ||
@@ -98,0 +100,0 @@ } |
{ | ||
"private": true, | ||
"name": "generateUrls", | ||
"version": "9.2.0", | ||
"version": "9.2.1", | ||
"description": "Universal Router Generate URLs Add-on", | ||
"homepage": "https://www.kriasoft.com/universal-router/", | ||
"repository": "kriasoft/universal-router", | ||
"repository": "github:kriasoft/universal-router", | ||
"author": "Kriasoft <support@kriasoft.com> (https://www.kriasoft.com)", | ||
@@ -9,0 +9,0 @@ "contributors": [ |
@@ -175,3 +175,3 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
context.next = next; | ||
context['next'] = next; | ||
return Promise.resolve().then(function () { | ||
@@ -178,0 +178,0 @@ return next(true, _this.root); |
@@ -173,3 +173,3 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
context.next = next; | ||
context['next'] = next; | ||
return Promise.resolve().then(function () { | ||
@@ -176,0 +176,0 @@ return next(true, _this.root); |
{ | ||
"name": "universal-router", | ||
"version": "9.2.0", | ||
"version": "9.2.1", | ||
"description": "Isomorphic router for JavaScript web applications", | ||
"homepage": "https://www.kriasoft.com/universal-router/", | ||
"repository": "kriasoft/universal-router", | ||
"repository": "github:kriasoft/universal-router", | ||
"author": "Kriasoft <support@kriasoft.com> (https://www.kriasoft.com)", | ||
@@ -8,0 +8,0 @@ "contributors": [ |
@@ -63,3 +63,3 @@ /** | ||
const token = tokens[i]; | ||
if (typeof token !== 'string') { | ||
if (token && typeof token !== 'string') { | ||
keys[token.name] = true; | ||
@@ -77,4 +77,4 @@ } | ||
const key = keys[i]; | ||
if (!regexp.keys[key]) { | ||
queryParams[key] = params[key]; | ||
if (key && !regexp.keys[key]) { | ||
queryParams[key] = params[key] ?? ''; | ||
} | ||
@@ -81,0 +81,0 @@ } |
@@ -60,3 +60,3 @@ /** | ||
for (let i = 0; i < routes.length; i++) { | ||
const childRoute = routes[i] | ||
const childRoute = routes[i]! | ||
const childName = childRoute.name | ||
@@ -121,3 +121,3 @@ childRoute.parent = route | ||
const token = tokens[i] | ||
if (typeof token !== 'string') { | ||
if (token && typeof token !== 'string') { | ||
keys[token.name] = true | ||
@@ -137,4 +137,4 @@ } | ||
const key = keys[i] | ||
if (!regexp.keys[key]) { | ||
queryParams[key] = params[key] | ||
if (key && !regexp.keys[key]) { | ||
queryParams[key] = params[key] ?? '' | ||
} | ||
@@ -141,0 +141,0 @@ } |
@@ -138,3 +138,3 @@ /** | ||
} | ||
context.next = next; | ||
context['next'] = next; | ||
return Promise.resolve() | ||
@@ -141,0 +141,0 @@ .then(() => next(true, this.root)) |
@@ -193,3 +193,3 @@ /** | ||
if (!childMatches) { | ||
const childRoute = route.children[childIndex] | ||
const childRoute = route.children[childIndex]! | ||
childRoute.parent = route | ||
@@ -324,3 +324,3 @@ | ||
context.next = next | ||
context['next'] = next | ||
@@ -327,0 +327,0 @@ return Promise.resolve() |
@@ -137,3 +137,3 @@ /** | ||
} | ||
context.next = next; | ||
context['next'] = next; | ||
try { | ||
@@ -140,0 +140,0 @@ return next(true, this.root); |
@@ -194,3 +194,3 @@ /** | ||
if (!childMatches) { | ||
const childRoute = route.children[childIndex] | ||
const childRoute = route.children[childIndex]! | ||
childRoute.parent = route | ||
@@ -322,3 +322,3 @@ | ||
context.next = next | ||
context['next'] = next | ||
@@ -325,0 +325,0 @@ try { |
@@ -173,3 +173,3 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
context.next = next; | ||
context['next'] = next; | ||
@@ -176,0 +176,0 @@ try { |
@@ -171,3 +171,3 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
context.next = next; | ||
context['next'] = next; | ||
@@ -174,0 +174,0 @@ try { |
{ | ||
"private": true, | ||
"name": "sync", | ||
"version": "9.2.0", | ||
"version": "9.2.1", | ||
"description": "Universal Router Sync Add-on", | ||
"homepage": "https://www.kriasoft.com/universal-router/", | ||
"repository": "kriasoft/universal-router", | ||
"repository": "github:kriasoft/universal-router", | ||
"author": "Kriasoft <support@kriasoft.com> (https://www.kriasoft.com)", | ||
@@ -9,0 +9,0 @@ "contributors": [ |
@@ -387,3 +387,3 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
if (typeof token !== 'string') { | ||
if (token && typeof token !== 'string') { | ||
keys[token.name] = true; | ||
@@ -410,4 +410,6 @@ } | ||
if (!regexp.keys[key]) { | ||
queryParams[key] = params[key]; | ||
if (key && !regexp.keys[key]) { | ||
var _params$key; | ||
queryParams[key] = (_params$key = params[key]) != null ? _params$key : ''; | ||
} | ||
@@ -414,0 +416,0 @@ } |
/*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).generateUrls=r()}(this,function(){"use strict";function b(e,r){void 0===r&&(r={});for(var n=function(e){for(var r=[],t=0;t<e.length;){var n=e[t];if("*"!==n&&"+"!==n&&"?"!==n)if("\\"!==n)if("{"!==n)if("}"!==n)if(":"!==n)if("("!==n)r.push({type:"CHAR",index:t,value:e[t++]});else{var i=1,a="";if("?"===e[f=t+1])throw new TypeError('Pattern cannot start with "?" at '+f);for(;f<e.length;)if("\\"!==e[f]){if(")"===e[f]){if(0===--i){f++;break}}else if("("===e[f]&&(i++,"?"!==e[f+1]))throw new TypeError("Capturing groups are not allowed at "+f);a+=e[f++]}else a+=e[f++]+e[f++];if(i)throw new TypeError("Unbalanced pattern at "+t);if(!a)throw new TypeError("Missing pattern at "+t);r.push({type:"PATTERN",index:t,value:a}),t=f}else{for(var o="",f=t+1;f<e.length;){var p=e.charCodeAt(f);if(!(48<=p&&p<=57||65<=p&&p<=90||97<=p&&p<=122||95===p))break;o+=e[f++]}if(!o)throw new TypeError("Missing parameter name at "+t);r.push({type:"NAME",index:t,value:o}),t=f}else r.push({type:"CLOSE",index:t,value:e[t++]});else r.push({type:"OPEN",index:t,value:e[t++]});else r.push({type:"ESCAPED_CHAR",index:t++,value:e[t++]});else r.push({type:"MODIFIER",index:t,value:e[t++]})}return r.push({type:"END",index:t,value:""}),r}(e),e=r.prefixes,t=void 0===e?"./":e,i="[^"+(r.delimiter||"/#?").replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")+"]+?",a=[],o=0,f=0,p="",u=function(e){if(f<n.length&&n[f].type===e)return n[f++].value},s=function(e){var r=u(e);if(void 0!==r)return r;var t=n[f],r=t.type,t=t.index;throw new TypeError("Unexpected "+r+" at "+t+", expected "+e)},l=function(){for(var e,r="";e=u("CHAR")||u("ESCAPED_CHAR");)r+=e;return r};f<n.length;){var d,h=u("CHAR"),y=u("NAME"),c=u("PATTERN");y||c?(-1===t.indexOf(d=h||"")&&(p+=d,d=""),p&&(a.push(p),p=""),a.push({name:y||o++,prefix:d,suffix:"",pattern:c||i,modifier:u("MODIFIER")||""})):(y=h||u("ESCAPED_CHAR"))?p+=y:(p&&(a.push(p),p=""),u("OPEN")?(d=l(),c=u("NAME")||"",h=u("PATTERN")||"",y=l(),s("CLOSE"),a.push({name:c||(h?o++:""),pattern:c&&!h?i:h,prefix:d,suffix:y,modifier:u("MODIFIER")||""})):s("END"))}return a}return function(x,e){if(!x)throw new ReferenceError("Router is not defined");var A=new Map,R=new Map,T=Object.assign({encode:encodeURIComponent},e);return function(e,r){var t=A.get(e);if(!(t||(A.clear(),R.clear(),function e(r,t,n,i,a){if(t.name&&i&&r.has(i))throw new Error('Route "'+i+'" already exists');if(t.name&&i&&r.set(i,t),n)for(var o=0;o<n.length;o++){var f=n[o],p=f.name;f.parent=t,e(r,f,f.children,i&&a?p?i+a+p:i:p,a)}}(A,x.root,x.root.children,x.root.name,T.uniqueRouteNameSep),t=A.get(e))))throw new Error('Route "'+e+'" not found');var u,n,s,l,d,i=R.get(t);if(!i){for(var a="",o=t;o;){var f=Array.isArray(o.path)?o.path[0]:o.path;f&&(a=f+a),o=o.parent}for(var p=b(a,T),h=(u=p,n=(e=h=void 0===(h=T)?{}:h)&&e.sensitive?"":"i",e=h.encode,s=void 0===e?function(e){return e}:e,l=void 0===(h=h.validate)||h,d=u.map(function(e){if("object"==typeof e)return new RegExp("^(?:"+e.pattern+")$",n)}),function(e){for(var r="",t=0;t<u.length;t++){var n=u[t];if("string"!=typeof n){var i=e?e[n.name]:void 0,a="?"===n.modifier||"*"===n.modifier,o="*"===n.modifier||"+"===n.modifier;if(Array.isArray(i)){if(!o)throw new TypeError('Expected "'+n.name+'" to not repeat, but got an array');if(0===i.length){if(a)continue;throw new TypeError('Expected "'+n.name+'" to not be empty')}for(var f=0;f<i.length;f++){var p=s(i[f],n);if(l&&!d[t].test(p))throw new TypeError('Expected all "'+n.name+'" to match "'+n.pattern+'", but got "'+p+'"');r+=n.prefix+p+n.suffix}}else if("string"!=typeof i&&"number"!=typeof i){if(!a)throw new TypeError('Expected "'+n.name+'" to be '+(o?"an array":"a string"))}else{p=s(String(i),n);if(l&&!d[t].test(p))throw new TypeError('Expected "'+n.name+'" to match "'+n.pattern+'", but got "'+p+'"');r+=n.prefix+p+n.suffix}}else r+=n}return r}),y=Object.create(null),c=0;c<p.length;c++){var v=p[c];"string"!=typeof v&&(y[v.name]=!0)}R.set(t,i={toPath:h,keys:y})}t=x.baseUrl+i.toPath(r)||"/";if(T.stringifyQueryParams&&r){for(var E={},g=Object.keys(r),m=0;m<g.length;m++){var w=g[m];i.keys[w]||(E[w]=r[w])}h=T.stringifyQueryParams(E);h&&(t+="?"===h.charAt(0)?h:"?"+h)}return t}}}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).generateUrls=r()}(this,function(){"use strict";function b(e,r){void 0===r&&(r={});for(var n=function(e){for(var r=[],t=0;t<e.length;){var n=e[t];if("*"!==n&&"+"!==n&&"?"!==n)if("\\"!==n)if("{"!==n)if("}"!==n)if(":"!==n)if("("!==n)r.push({type:"CHAR",index:t,value:e[t++]});else{var i=1,a="";if("?"===e[f=t+1])throw new TypeError('Pattern cannot start with "?" at '+f);for(;f<e.length;)if("\\"!==e[f]){if(")"===e[f]){if(0===--i){f++;break}}else if("("===e[f]&&(i++,"?"!==e[f+1]))throw new TypeError("Capturing groups are not allowed at "+f);a+=e[f++]}else a+=e[f++]+e[f++];if(i)throw new TypeError("Unbalanced pattern at "+t);if(!a)throw new TypeError("Missing pattern at "+t);r.push({type:"PATTERN",index:t,value:a}),t=f}else{for(var o="",f=t+1;f<e.length;){var p=e.charCodeAt(f);if(!(48<=p&&p<=57||65<=p&&p<=90||97<=p&&p<=122||95===p))break;o+=e[f++]}if(!o)throw new TypeError("Missing parameter name at "+t);r.push({type:"NAME",index:t,value:o}),t=f}else r.push({type:"CLOSE",index:t,value:e[t++]});else r.push({type:"OPEN",index:t,value:e[t++]});else r.push({type:"ESCAPED_CHAR",index:t++,value:e[t++]});else r.push({type:"MODIFIER",index:t,value:e[t++]})}return r.push({type:"END",index:t,value:""}),r}(e),e=r.prefixes,t=void 0===e?"./":e,i="[^"+(r.delimiter||"/#?").replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")+"]+?",a=[],o=0,f=0,p="",u=function(e){if(f<n.length&&n[f].type===e)return n[f++].value},s=function(e){var r=u(e);if(void 0!==r)return r;var t=n[f],r=t.type,t=t.index;throw new TypeError("Unexpected "+r+" at "+t+", expected "+e)},l=function(){for(var e,r="";e=u("CHAR")||u("ESCAPED_CHAR");)r+=e;return r};f<n.length;){var d,h=u("CHAR"),y=u("NAME"),c=u("PATTERN");y||c?(-1===t.indexOf(d=h||"")&&(p+=d,d=""),p&&(a.push(p),p=""),a.push({name:y||o++,prefix:d,suffix:"",pattern:c||i,modifier:u("MODIFIER")||""})):(y=h||u("ESCAPED_CHAR"))?p+=y:(p&&(a.push(p),p=""),u("OPEN")?(d=l(),c=u("NAME")||"",h=u("PATTERN")||"",y=l(),s("CLOSE"),a.push({name:c||(h?o++:""),pattern:c&&!h?i:h,prefix:d,suffix:y,modifier:u("MODIFIER")||""})):s("END"))}return a}return function(x,e){if(!x)throw new ReferenceError("Router is not defined");var A=new Map,R=new Map,T=Object.assign({encode:encodeURIComponent},e);return function(e,r){var t=A.get(e);if(!(t||(A.clear(),R.clear(),function e(r,t,n,i,a){if(t.name&&i&&r.has(i))throw new Error('Route "'+i+'" already exists');if(t.name&&i&&r.set(i,t),n)for(var o=0;o<n.length;o++){var f=n[o],p=f.name;f.parent=t,e(r,f,f.children,i&&a?p?i+a+p:i:p,a)}}(A,x.root,x.root.children,x.root.name,T.uniqueRouteNameSep),t=A.get(e))))throw new Error('Route "'+e+'" not found');var u,n,s,l,d,i=R.get(t);if(!i){for(var a="",o=t;o;){var f=Array.isArray(o.path)?o.path[0]:o.path;f&&(a=f+a),o=o.parent}for(var p=b(a,T),h=(u=p,n=(e=h=void 0===(h=T)?{}:h)&&e.sensitive?"":"i",e=h.encode,s=void 0===e?function(e){return e}:e,l=void 0===(h=h.validate)||h,d=u.map(function(e){if("object"==typeof e)return new RegExp("^(?:"+e.pattern+")$",n)}),function(e){for(var r="",t=0;t<u.length;t++){var n=u[t];if("string"!=typeof n){var i=e?e[n.name]:void 0,a="?"===n.modifier||"*"===n.modifier,o="*"===n.modifier||"+"===n.modifier;if(Array.isArray(i)){if(!o)throw new TypeError('Expected "'+n.name+'" to not repeat, but got an array');if(0===i.length){if(a)continue;throw new TypeError('Expected "'+n.name+'" to not be empty')}for(var f=0;f<i.length;f++){var p=s(i[f],n);if(l&&!d[t].test(p))throw new TypeError('Expected all "'+n.name+'" to match "'+n.pattern+'", but got "'+p+'"');r+=n.prefix+p+n.suffix}}else if("string"!=typeof i&&"number"!=typeof i){if(!a)throw new TypeError('Expected "'+n.name+'" to be '+(o?"an array":"a string"))}else{p=s(String(i),n);if(l&&!d[t].test(p))throw new TypeError('Expected "'+n.name+'" to match "'+n.pattern+'", but got "'+p+'"');r+=n.prefix+p+n.suffix}}else r+=n}return r}),y=Object.create(null),c=0;c<p.length;c++){var v=p[c];v&&"string"!=typeof v&&(y[v.name]=!0)}R.set(t,i={toPath:h,keys:y})}t=x.baseUrl+i.toPath(r)||"/";if(T.stringifyQueryParams&&r){for(var E={},g=Object.keys(r),m=0;m<g.length;m++){var w=g[m];w&&!i.keys[w]&&(E[w]=null!=(w=r[w])?w:"")}h=T.stringifyQueryParams(E);h&&(t+="?"===h.charAt(0)?h:"?"+h)}return t}}}); | ||
//# sourceMappingURL=universal-router-generate-urls.min.js.map |
@@ -560,3 +560,3 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
context.next = next; | ||
context['next'] = next; | ||
@@ -563,0 +563,0 @@ try { |
@@ -562,3 +562,3 @@ /*! Universal Router | MIT License | https://www.kriasoft.com/universal-router/ */ | ||
context.next = next; | ||
context['next'] = next; | ||
return Promise.resolve().then(function () { | ||
@@ -565,0 +565,0 @@ return next(true, _this.root); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
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
384290
3562