Skip to content

Commit

Permalink
perf(router): use substring instead of substr
Browse files Browse the repository at this point in the history
  • Loading branch information
jiawei397 committed Dec 21, 2021
1 parent 8c76f61 commit 350bfdf
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { transferParam } from "./params.ts";
import { Context } from "../deps.ts";
import { checkByInterceptors } from "./interceptor.ts";

class Router extends OriginRouter {
export class Router extends OriginRouter {
[x: string]: any
private apiPrefix = "";
private routerArr: {
Expand Down Expand Up @@ -44,7 +44,7 @@ class Router extends OriginRouter {
last = "/" + last;
}
if (last.endsWith("/")) {
last = last.substr(0, last.length - 1);
last = last.substring(0, last.length - 1);
}
return last;
}
Expand Down Expand Up @@ -160,5 +160,3 @@ class Router extends OriginRouter {
return result;
}
}

export { Router };

0 comments on commit 350bfdf

Please sign in to comment.