Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

router-trie

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

router-trie - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

2

dist/index.modern.js

@@ -1,2 +0,2 @@

const e=["children"],t=Symbol("index"),l=Symbol("dynamic"),r=Symbol("catch-all"),n=Symbol("route"),i=Symbol("root");function o(e,t,l={}){let r=c(e,((t?t.replace(/^\//,"").replace(/\/$/,""):null)||"").split("/").filter(Boolean),0,[],l.onVisit);return r.length?function(e){let t,l=Number.MIN_SAFE_INTEGER;for(let r of e){let e=0;for(let t of r)e+=h(t);e>l&&(l=e,t=r)}return t}(r):null}function c(e,o,f,u,h){if(!e)return u;console.log("HERE"),h&&h(e);let s=o.length;if(f>=s)switch(e.key){case t:c(e.children[0],o,f,u,h);break;case l:case r:break;case n:e.route&&u.push(function(e){if(!e.route)return null;let t=[],l=e;for(;l;)l.route&&t.push(l.route),l=l.parent;return t.reverse()}(e));case i:for(let t of e.children)c(t,o,f,u,h)}else if("string"==typeof e.key){if(e.key===o[f])for(let t of e.children)c(t,o,f+1,u,h)}else switch(e.key){case t:break;case r:c(e.children[0],o,s,u,h);break;case l:f++;case i:case n:for(let t of e.children)c(t,o,f,u,h)}return u}let f=/\/?:\w+$/,u=e=>"*"===e;function h(e){let t=(e.path||"").split("/").filter(Boolean),l=t.length;return t.some(u)&&(l+=0),e.index&&(l+=3),t.filter(e=>!u(e)).reduce((e,t)=>e+(f.test(t)?4:""===t?2:10),l)}function s(e){let t={key:i,parent:null,children:[],route:null};for(let l of e)a(t,l);return t}function a(e,i){let o=function(e,i,o){let c=i.split("/"),f=c.length,u=e;for(let e=0;e<f;e++){let t=c[e];if(!t)continue;if(t.startsWith("*")){if(u.children.find(e=>e.key===r))throw new Error("Only one catch all route is allowed per branch of the tree");let e=d(r,u);u.children.push(e),u=e;break}if(t.startsWith(":")){let e=u.children.find(e=>e.key===l);if(e)u=e;else{let e=d(l,u);u.children.push(e),u=e}continue}let n=u.children.find(e=>e.key===t);if(n)u=n;else{let e=d(t,u);u.children.push(e),u=e}}if(o.index){let e=d(t,u);u.children.push(e),u=e}let h=d(n,u,o);return u.children.push(h),u=h,u}(e,i.path?i.path.replace(/^\//,"").replace(/\/$/,""):"",i);if(!i.index&&i.children)for(let e of i.children)a(o,e);return o}function d(t,l,r=null){if(r){let t=function(e,t){if(null==e)return{};var l,r,n={},i=Object.keys(e);for(r=0;r<i.length;r++)t.indexOf(l=i[r])>=0||(n[l]=e[l]);return n}(r,e);r=t}return{key:t,route:r,parent:l,children:[]}}export{r as CATCH_ALL_SYMBOL,l as DYNAMIC_SYMBOL,t as INDEX_SYMBOL,i as ROOT_SYMBOL,n as ROUTE_SYMBOL,s as createTrie,o as matchTrie};
const e=["children"],t=Symbol("index"),r=Symbol("dynamic"),l=Symbol("catch-all"),n=Symbol("route"),i=Symbol("root");function o(e,t,r={}){let l=c(e,((t?t.replace(/^\//,"").replace(/\/$/,""):null)||"").split("/").filter(Boolean),0,[],r.onVisit);return l.length?function(e){let t,r=Number.MIN_SAFE_INTEGER;for(let l of e){let e=0;for(let t of l)e+=h(t);e>r&&(r=e,t=l)}return t}(l):null}function c(e,o,f,u,h){if(!e)return u;h&&h(e);let s=o.length;if(f>=s)switch(e.key){case t:c(e.children[0],o,f,u,h);break;case r:case l:break;case n:e.route&&u.push(function(e){if(!e.route)return null;let t=[],r=e;for(;r;)r.route&&t.push(r.route),r=r.parent;return t.reverse()}(e));case i:for(let t of e.children)c(t,o,f,u,h)}else if("string"==typeof e.key){if(e.key===o[f])for(let t of e.children)c(t,o,f+1,u,h)}else switch(e.key){case t:break;case l:c(e.children[0],o,s,u,h);break;case r:f++;case i:case n:for(let t of e.children)c(t,o,f,u,h)}return u}let f=/\/?:\w+$/,u=e=>"*"===e;function h(e){let t=(e.path||"").split("/").filter(Boolean),r=t.length;return t.some(u)&&(r+=0),e.index&&(r+=3),t.filter(e=>!u(e)).reduce((e,t)=>e+(f.test(t)?4:""===t?2:10),r)}function s(e){let t={key:i,parent:null,children:[],route:null};for(let r of e)a(t,r);return t}function a(e,i){let o=function(e,i,o){let c=i.split("/"),f=c.length,u=e;for(let e=0;e<f;e++){let t=c[e];if(!t)continue;if(t.startsWith("*")){if(u.children.find(e=>e.key===l))throw new Error("Only one catch all route is allowed per branch of the tree");let e=d(l,u);u.children.push(e),u=e;break}if(t.startsWith(":")){let e=u.children.find(e=>e.key===r);if(e)u=e;else{let e=d(r,u);u.children.push(e),u=e}continue}let n=u.children.find(e=>e.key===t);if(n)u=n;else{let e=d(t,u);u.children.push(e),u=e}}if(o.index){let e=d(t,u);u.children.push(e),u=e}let h=d(n,u,o);return u.children.push(h),u=h,u}(e,i.path?i.path.replace(/^\//,"").replace(/\/$/,""):"",i);if(!i.index&&i.children)for(let e of i.children)a(o,e);return o}function d(t,r,l=null){if(l){let t=function(e,t){if(null==e)return{};var r,l,n={},i=Object.keys(e);for(l=0;l<i.length;l++)t.indexOf(r=i[l])>=0||(n[r]=e[r]);return n}(l,e);l=t}return{key:t,route:l,parent:r,children:[]}}export{l as CATCH_ALL_SYMBOL,r as DYNAMIC_SYMBOL,t as INDEX_SYMBOL,i as ROOT_SYMBOL,n as ROUTE_SYMBOL,s as createTrie,o as matchTrie};
//# sourceMappingURL=index.modern.js.map

@@ -1,2 +0,2 @@

function e(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function r(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=function(r,n){if(r){if("string"==typeof r)return e(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?e(r,n):void 0}}(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var o=0;return function(){return o>=r.length?{done:!0}:{done:!1,value:r[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n=["children"],t=Symbol("index"),o=Symbol("dynamic"),i=Symbol("catch-all"),a=Symbol("route"),l=Symbol("root");function u(e,n,t){void 0===t&&(t={});var o=c(e,((n?n.replace(/^\//,"").replace(/\/$/,""):null)||"").split("/").filter(Boolean),0,[],t.onVisit);return o.length?function(e){for(var n,t,o=Number.MIN_SAFE_INTEGER,i=r(e);!(t=i()).done;){for(var a,l=t.value,u=0,c=r(l);!(a=c()).done;)u+=(s=void 0,v=void 0,v=(s=((h=a.value).path||"").split("/").filter(Boolean)).length,s.some(d)&&(v+=0),h.index&&(v+=3),s.filter(function(e){return!d(e)}).reduce(function(e,r){return e+(f.test(r)?4:""===r?2:10)},v));u>o&&(o=u,n=l)}var h,s,v;return n}(o):null}function c(e,n,u,f,d){if(!e)return f;console.log("HERE"),d&&d(e);var h=n.length;if(u>=h)switch(e.key){case t:c(e.children[0],n,u,f,d);break;case o:case i:break;case a:e.route&&f.push(function(e){if(!e.route)return null;for(var r=[],n=e;n;)n.route&&r.push(n.route),n=n.parent;return r.reverse()}(e));case l:for(var s,v=r(e.children);!(s=v()).done;)c(s.value,n,u,f,d)}else if("string"==typeof e.key){if(e.key===n[u])for(var p,y=r(e.children);!(p=y()).done;)c(p.value,n,u+1,f,d)}else switch(e.key){case t:break;case i:c(e.children[0],n,h,f,d);break;case o:u++;case l:case a:for(var b,m=r(e.children);!(b=m()).done;)c(b.value,n,u,f,d)}return f}var f=/\/?:\w+$/,d=function(e){return"*"===e};function h(e){for(var n,t={key:l,parent:null,children:[],route:null},o=r(e);!(n=o()).done;)s(t,n.value);return t}function s(e,n){var l=function(e,r,n){for(var l=r.split("/"),u=l.length,c=e,f=function(e){var r=l[e];if(!r)return"continue";if(r.startsWith("*")){if(c.children.find(function(e){return e.key===i}))throw new Error("Only one catch all route is allowed per branch of the tree");var n=v(i,c);return c.children.push(n),c=n,"break"}if(r.startsWith(":")){var t=c.children.find(function(e){return e.key===o});if(t)c=t;else{var a=v(o,c);c.children.push(a),c=a}return"continue"}var u=c.children.find(function(e){return e.key===r});if(u)c=u;else{var f=v(r,c);c.children.push(f),c=f}},d=0;d<u;d++){var h=f(d);if("continue"!==h&&"break"===h)break}if(n.index){var s=v(t,c);c.children.push(s),c=s}var p=v(a,c,n);return c.children.push(p),c=p}(e,n.path?n.path.replace(/^\//,"").replace(/\/$/,""):"",n);if(!n.index&&n.children)for(var u,c=r(n.children);!(u=c()).done;)s(l,u.value);return l}function v(e,r,t){if(void 0===t&&(t=null),t){var o=function(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)r.indexOf(n=i[t])>=0||(o[n]=e[n]);return o}(t,n);t=o}return{key:e,route:t,parent:r,children:[]}}export{i as CATCH_ALL_SYMBOL,o as DYNAMIC_SYMBOL,t as INDEX_SYMBOL,l as ROOT_SYMBOL,a as ROUTE_SYMBOL,h as createTrie,u as matchTrie};
function e(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function r(r,n){var t="undefined"!=typeof Symbol&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=function(r,n){if(r){if("string"==typeof r)return e(r,n);var t=Object.prototype.toString.call(r).slice(8,-1);return"Object"===t&&r.constructor&&(t=r.constructor.name),"Map"===t||"Set"===t?Array.from(r):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?e(r,n):void 0}}(r))||n&&r&&"number"==typeof r.length){t&&(r=t);var i=0;return function(){return i>=r.length?{done:!0}:{done:!1,value:r[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var n=["children"],t=Symbol("index"),i=Symbol("dynamic"),o=Symbol("catch-all"),a=Symbol("route"),l=Symbol("root");function u(e,n,t){void 0===t&&(t={});var i=c(e,((n?n.replace(/^\//,"").replace(/\/$/,""):null)||"").split("/").filter(Boolean),0,[],t.onVisit);return i.length?function(e){for(var n,t,i=Number.MIN_SAFE_INTEGER,o=r(e);!(t=o()).done;){for(var a,l=t.value,u=0,c=r(l);!(a=c()).done;)u+=(s=void 0,v=void 0,v=(s=((h=a.value).path||"").split("/").filter(Boolean)).length,s.some(d)&&(v+=0),h.index&&(v+=3),s.filter(function(e){return!d(e)}).reduce(function(e,r){return e+(f.test(r)?4:""===r?2:10)},v));u>i&&(i=u,n=l)}var h,s,v;return n}(i):null}function c(e,n,u,f,d){if(!e)return f;d&&d(e);var h=n.length;if(u>=h)switch(e.key){case t:c(e.children[0],n,u,f,d);break;case i:case o:break;case a:e.route&&f.push(function(e){if(!e.route)return null;for(var r=[],n=e;n;)n.route&&r.push(n.route),n=n.parent;return r.reverse()}(e));case l:for(var s,v=r(e.children);!(s=v()).done;)c(s.value,n,u,f,d)}else if("string"==typeof e.key){if(e.key===n[u])for(var p,y=r(e.children);!(p=y()).done;)c(p.value,n,u+1,f,d)}else switch(e.key){case t:break;case o:c(e.children[0],n,h,f,d);break;case i:u++;case l:case a:for(var b,m=r(e.children);!(b=m()).done;)c(b.value,n,u,f,d)}return f}var f=/\/?:\w+$/,d=function(e){return"*"===e};function h(e){for(var n,t={key:l,parent:null,children:[],route:null},i=r(e);!(n=i()).done;)s(t,n.value);return t}function s(e,n){var l=function(e,r,n){for(var l=r.split("/"),u=l.length,c=e,f=function(e){var r=l[e];if(!r)return"continue";if(r.startsWith("*")){if(c.children.find(function(e){return e.key===o}))throw new Error("Only one catch all route is allowed per branch of the tree");var n=v(o,c);return c.children.push(n),c=n,"break"}if(r.startsWith(":")){var t=c.children.find(function(e){return e.key===i});if(t)c=t;else{var a=v(i,c);c.children.push(a),c=a}return"continue"}var u=c.children.find(function(e){return e.key===r});if(u)c=u;else{var f=v(r,c);c.children.push(f),c=f}},d=0;d<u;d++){var h=f(d);if("continue"!==h&&"break"===h)break}if(n.index){var s=v(t,c);c.children.push(s),c=s}var p=v(a,c,n);return c.children.push(p),c=p}(e,n.path?n.path.replace(/^\//,"").replace(/\/$/,""):"",n);if(!n.index&&n.children)for(var u,c=r(n.children);!(u=c()).done;)s(l,u.value);return l}function v(e,r,t){if(void 0===t&&(t=null),t){var i=function(e,r){if(null==e)return{};var n,t,i={},o=Object.keys(e);for(t=0;t<o.length;t++)r.indexOf(n=o[t])>=0||(i[n]=e[n]);return i}(t,n);t=i}return{key:e,route:t,parent:r,children:[]}}export{o as CATCH_ALL_SYMBOL,i as DYNAMIC_SYMBOL,t as INDEX_SYMBOL,l as ROOT_SYMBOL,a as ROUTE_SYMBOL,h as createTrie,u as matchTrie};
//# sourceMappingURL=index.module.js.map

@@ -1,2 +0,2 @@

!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e||self).routerTrie={})}(this,function(e){function r(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function n(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var o=0;return function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var t=["children"],o=Symbol("index"),i=Symbol("dynamic"),a=Symbol("catch-all"),l=Symbol("route"),u=Symbol("root");function c(e,r,t,f,d){if(!e)return f;console.log("HERE"),d&&d(e);var s=r.length;if(t>=s)switch(e.key){case o:c(e.children[0],r,t,f,d);break;case i:case a:break;case l:e.route&&f.push(function(e){if(!e.route)return null;for(var r=[],n=e;n;)n.route&&r.push(n.route),n=n.parent;return r.reverse()}(e));case u:for(var h,v=n(e.children);!(h=v()).done;)c(h.value,r,t,f,d)}else if("string"==typeof e.key){if(e.key===r[t])for(var p,y=n(e.children);!(p=y()).done;)c(p.value,r,t+1,f,d)}else switch(e.key){case o:break;case a:c(e.children[0],r,s,f,d);break;case i:t++;case u:case l:for(var b,m=n(e.children);!(b=m()).done;)c(b.value,r,t,f,d)}return f}var f=/\/?:\w+$/,d=function(e){return"*"===e};function s(e,r){var t=function(e,r,n){for(var t=r.split("/"),u=t.length,c=e,f=function(e){var r=t[e];if(!r)return"continue";if(r.startsWith("*")){if(c.children.find(function(e){return e.key===a}))throw new Error("Only one catch all route is allowed per branch of the tree");var n=h(a,c);return c.children.push(n),c=n,"break"}if(r.startsWith(":")){var o=c.children.find(function(e){return e.key===i});if(o)c=o;else{var l=h(i,c);c.children.push(l),c=l}return"continue"}var u=c.children.find(function(e){return e.key===r});if(u)c=u;else{var f=h(r,c);c.children.push(f),c=f}},d=0;d<u;d++){var s=f(d);if("continue"!==s&&"break"===s)break}if(n.index){var v=h(o,c);c.children.push(v),c=v}var p=h(l,c,n);return c.children.push(p),c=p}(e,r.path?r.path.replace(/^\//,"").replace(/\/$/,""):"",r);if(!r.index&&r.children)for(var u,c=n(r.children);!(u=c()).done;)s(t,u.value);return t}function h(e,r,n){if(void 0===n&&(n=null),n){var o=function(e,r){if(null==e)return{};var n,t,o={},i=Object.keys(e);for(t=0;t<i.length;t++)r.indexOf(n=i[t])>=0||(o[n]=e[n]);return o}(n,t);n=o}return{key:e,route:n,parent:r,children:[]}}e.CATCH_ALL_SYMBOL=a,e.DYNAMIC_SYMBOL=i,e.INDEX_SYMBOL=o,e.ROOT_SYMBOL=u,e.ROUTE_SYMBOL=l,e.createTrie=function(e){for(var r,t={key:u,parent:null,children:[],route:null},o=n(e);!(r=o()).done;)s(t,r.value);return t},e.matchTrie=function(e,r,t){void 0===t&&(t={});var o=c(e,((r?r.replace(/^\//,"").replace(/\/$/,""):null)||"").split("/").filter(Boolean),0,[],t.onVisit);return o.length?function(e){for(var r,t,o=Number.MIN_SAFE_INTEGER,i=n(e);!(t=i()).done;){for(var a,l=t.value,u=0,c=n(l);!(a=c()).done;)u+=(h=void 0,v=void 0,v=(h=((s=a.value).path||"").split("/").filter(Boolean)).length,h.some(d)&&(v+=0),s.index&&(v+=3),h.filter(function(e){return!d(e)}).reduce(function(e,r){return e+(f.test(r)?4:""===r?2:10)},v));u>o&&(o=u,r=l)}var s,h,v;return r}(o):null}});
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r((e||self).routerTrie={})}(this,function(e){function r(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}function n(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(t)return(t=t.call(e)).next.bind(t);if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return r(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?r(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);var i=0;return function(){return i>=e.length?{done:!0}:{done:!1,value:e[i++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var t=["children"],i=Symbol("index"),o=Symbol("dynamic"),a=Symbol("catch-all"),l=Symbol("route"),u=Symbol("root");function c(e,r,t,f,d){if(!e)return f;d&&d(e);var s=r.length;if(t>=s)switch(e.key){case i:c(e.children[0],r,t,f,d);break;case o:case a:break;case l:e.route&&f.push(function(e){if(!e.route)return null;for(var r=[],n=e;n;)n.route&&r.push(n.route),n=n.parent;return r.reverse()}(e));case u:for(var h,v=n(e.children);!(h=v()).done;)c(h.value,r,t,f,d)}else if("string"==typeof e.key){if(e.key===r[t])for(var p,y=n(e.children);!(p=y()).done;)c(p.value,r,t+1,f,d)}else switch(e.key){case i:break;case a:c(e.children[0],r,s,f,d);break;case o:t++;case u:case l:for(var b,m=n(e.children);!(b=m()).done;)c(b.value,r,t,f,d)}return f}var f=/\/?:\w+$/,d=function(e){return"*"===e};function s(e,r){var t=function(e,r,n){for(var t=r.split("/"),u=t.length,c=e,f=function(e){var r=t[e];if(!r)return"continue";if(r.startsWith("*")){if(c.children.find(function(e){return e.key===a}))throw new Error("Only one catch all route is allowed per branch of the tree");var n=h(a,c);return c.children.push(n),c=n,"break"}if(r.startsWith(":")){var i=c.children.find(function(e){return e.key===o});if(i)c=i;else{var l=h(o,c);c.children.push(l),c=l}return"continue"}var u=c.children.find(function(e){return e.key===r});if(u)c=u;else{var f=h(r,c);c.children.push(f),c=f}},d=0;d<u;d++){var s=f(d);if("continue"!==s&&"break"===s)break}if(n.index){var v=h(i,c);c.children.push(v),c=v}var p=h(l,c,n);return c.children.push(p),c=p}(e,r.path?r.path.replace(/^\//,"").replace(/\/$/,""):"",r);if(!r.index&&r.children)for(var u,c=n(r.children);!(u=c()).done;)s(t,u.value);return t}function h(e,r,n){if(void 0===n&&(n=null),n){var i=function(e,r){if(null==e)return{};var n,t,i={},o=Object.keys(e);for(t=0;t<o.length;t++)r.indexOf(n=o[t])>=0||(i[n]=e[n]);return i}(n,t);n=i}return{key:e,route:n,parent:r,children:[]}}e.CATCH_ALL_SYMBOL=a,e.DYNAMIC_SYMBOL=o,e.INDEX_SYMBOL=i,e.ROOT_SYMBOL=u,e.ROUTE_SYMBOL=l,e.createTrie=function(e){for(var r,t={key:u,parent:null,children:[],route:null},i=n(e);!(r=i()).done;)s(t,r.value);return t},e.matchTrie=function(e,r,t){void 0===t&&(t={});var i=c(e,((r?r.replace(/^\//,"").replace(/\/$/,""):null)||"").split("/").filter(Boolean),0,[],t.onVisit);return i.length?function(e){for(var r,t,i=Number.MIN_SAFE_INTEGER,o=n(e);!(t=o()).done;){for(var a,l=t.value,u=0,c=n(l);!(a=c()).done;)u+=(h=void 0,v=void 0,v=(h=((s=a.value).path||"").split("/").filter(Boolean)).length,h.some(d)&&(v+=0),s.index&&(v+=3),h.filter(function(e){return!d(e)}).reduce(function(e,r){return e+(f.test(r)?4:""===r?2:10)},v));u>i&&(i=u,r=l)}var s,h,v;return r}(i):null}});
//# sourceMappingURL=index.umd.js.map
{
"name": "router-trie",
"version": "0.0.3",
"version": "0.0.4",
"type": "module",

@@ -5,0 +5,0 @@ "source": "src/index.ts",

@@ -34,3 +34,2 @@ export const INDEX_SYMBOL = Symbol("index"),

console.log("HERE")
if (onVisit) onVisit(root);

@@ -37,0 +36,0 @@

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc