修复strict默认值问题

This commit is contained in:
2024-12-05 08:44:19 +08:00
parent 5d2549f52d
commit fd364fb393
2 changed files with 2 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@yizhi/koa-router", "name": "@yizhi/koa-router",
"version": "1.0.2", "version": "1.0.3",
"main": "dist/index.js", "main": "dist/index.js",
"types": "typing/index.d.ts", "types": "typing/index.d.ts",
"scripts": {}, "scripts": {},

View File

@ -153,7 +153,7 @@ export class KoaRouter {
let regexpStr = "^" + regexpItems.join("") + pathname.slice(offset); let regexpStr = "^" + regexpItems.join("") + pathname.slice(offset);
//严格模式 //严格模式
if (option?.strict) regexpStr += "$"; if (option?.strict ?? true) regexpStr += "$";
else regexpStr += "\\b"; else regexpStr += "\\b";
//生成正则表达式 //生成正则表达式