@mapl/router 0.10.1 → 0.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/method/compiler.js +1 -1
- package/package.json +1 -1
package/method/compiler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isEmptyNode}from"../tree/node.js";import{compile}from"../tree/compiler.js";let STR,START_IDX;let each=(value,path)=>{STR+=`case"${START_IDX===1?path:path.slice(1)}":{${value}}`};let compileSubrouter=(mp,node)=>{if(mp.size>0){STR+=`switch(p){`;mp.forEach(each);STR+=`}`}isEmptyNode(node)||(STR
|
|
1
|
+
import{isEmptyNode}from"../tree/node.js";import{compile,shouldBoundCheck}from"../tree/compiler.js";let STR,START_IDX;let each=(value,path)=>{STR+=`case"${START_IDX===1?path:path.slice(1)}":{${value}}`};let compileSubrouter=(mp,node)=>{if(mp.size>0){STR+=`switch(p){`;mp.forEach(each);STR+=`}`}isEmptyNode(node)||(STR+=mp.has(`/`)||!shouldBoundCheck(node)?`{let l=p.length;${compile(node,0,START_IDX,``)}}`:`{let l=p.length;if(l>${START_IDX}){${compile(node,0,START_IDX,``)}}}`)};export default (router,methodInput,start)=>{STR=``;START_IDX=start;let methods=router[0];if(methods.length>0){let nodes=router[1];let maps=router[2];STR+=`switch(${methodInput}){`;for(let i=0;i<methods.length;i++){STR+=`case"${methods[i]}":`;compileSubrouter(maps[i],nodes[i])}STR+=`}`}router.length===3||compileSubrouter(router[4],router[3]);return STR};
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"@mapl/router","version":"0.10.
|
|
1
|
+
{"name":"@mapl/router","version":"0.10.3","description":"The fastest possible JS router","repository":{"type":"git","url":"git+https://github.com/mapljs/router.git"},"license":"MIT","type":"module","exports":{"./tree/match":"./tree/match.js","./tree/compiler":"./tree/compiler.js","./utils":"./utils.js","./tree/node":"./tree/node.js","./constants":"./constants.js","./method":"./method/index.js","./method/compiler":"./method/compiler.js"}}
|