@mapl/router 0.4.6 → 0.4.7

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.
@@ -1,4 +1,4 @@
1
1
  import type { Compiler } from '../tree/compiler.js';
2
2
  import { type Router } from './index.js';
3
- declare const _default: (router: Router<string>, compile: Compiler, methodInput: string, startIndex: 0 | 1) => string;
3
+ declare const _default: (router: Router<string>, compile: Compiler, methodInput: string, parsePath: string, startIndex: 0 | 1) => string;
4
4
  export default _default;
@@ -1 +1 @@
1
- export default (router,compile,methodInput,startIndex)=>{let str="switch("+methodInput+"){";for(let key in router)str+='case"'+key+'":'+compilePath(router[key],compile,startIndex)+"break;";str+="}";let all=router[ALL];if(all!=null)str+=compilePath(all,compile,startIndex);return str};import{ALL}from"./index.js";import compilePath from"../path/compiler.js";
1
+ export default (router,compile,methodInput,parsePath,startIndex)=>{let str="switch("+methodInput+"){";for(let key in router)str+='case"'+key+'":{'+parsePath+compilePath(router[key],compile,startIndex)+"break;}";str+="}";let all=router[ALL];if(all!=null)str+=parsePath+compilePath(all,compile,startIndex);return str};import{ALL}from"./index.js";import compilePath from"../path/compiler.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mapl/router",
3
- "version": "0.4.6",
3
+ "version": "0.4.7",
4
4
  "main": "./index.js",
5
5
  "devDependencies": {
6
6
  "@stylistic/eslint-plugin": "latest",
package/path/compiler.js CHANGED
@@ -1 +1 @@
1
- export default (router,compile,startIndex)=>router[0].map((pair)=>'if(p==="'+pair[0].slice(startIndex)+'"){'+pair[1]+"}").join("")+(router[1]===null?"":"{let l=p.length;"+compile(router[1],0,-startIndex,""))+"}";
1
+ export default (router,compile,startIndex)=>router[0].map((pair)=>'if(p==="'+pair[0].slice(startIndex)+'"){'+pair[1]+"}").join("")+(router[1]===null?"":"let l=p.length;"+compile(router[1],0,-startIndex,""));