@mapl/router 0.0.5 → 0.0.6

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.
Files changed (2) hide show
  1. package/index.js +1 -1
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1 +1 @@
1
- export function createRouter(){return[null,null]}export function insertItem(router,path,item){if(path.includes("*"))nodeInsertItem(router[1]??=createNode("/"),path,item);else(router[0]??={})[path]=item}export function compileRouter(router,state){if(router[0]!==null){const staticMap=router[0];const contentBuilder=state.contentBuilder;for(const key in staticMap){contentBuilder.push(`if(${PATH}===${JSON.stringify(key.slice(1))}){`);state.compileItem(staticMap[key],state,false);contentBuilder.push("}")}}if(router[1]!==null)compileNode(router[1],state,false,false,-1,"")}import{PATH}from"./constants";import{compileNode}from"./tree/compiler";import{createNode,insertItem as nodeInsertItem}from"./tree/node";
1
+ export function createRouter(){return[null,null]}export function insertItem(router,path,item){if(path.includes("*"))nodeInsertItem(router[1]??=createNode("/"),path,item);else(router[0]??={})[path]=item}export function compileRouter(router,state){const contentBuilder=state.contentBuilder;if(router[0]!==null){const staticMap=router[0];for(const key in staticMap){contentBuilder.push(`if(${PATH}===${JSON.stringify(key.slice(1))}){`);state.compileItem(staticMap[key],state,false);contentBuilder.push("}")}}contentBuilder.push(`const ${PATH_LEN}=${PATH}.length;`);if(router[1]!==null)compileNode(router[1],state,false,false,-1,"")}import{PATH,PATH_LEN}from"./constants";import{compileNode}from"./tree/compiler";import{createNode,insertItem as nodeInsertItem}from"./tree/node";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapl/router",
3
- "version": "0.0.5",
3
+ "version": "0.0.6",
4
4
  "description": "Fast compiled router for all runtimes",
5
5
  "keywords": [
6
6
  "fast",