parent
1bee190441
commit
cf429f0d3f
@ -21,7 +21,7 @@ export class PathCheckTool {
|
||||
* @param {string} path - 要检查的路径。
|
||||
* @returns {boolean} 如果路径精确匹配则返回 true,否则返回 false。
|
||||
*/
|
||||
exactCheck(path: string): boolean {
|
||||
exact(path: string): boolean {
|
||||
return this.pathname === this.makePath(path)
|
||||
}
|
||||
|
||||
@ -30,7 +30,7 @@ export class PathCheckTool {
|
||||
* @param {string} path - 要检查的路径。
|
||||
* @returns {boolean} 如果路径以基础 URL 的路径为前缀则返回 true,否则返回 false。
|
||||
*/
|
||||
startsWithCheck(path: string): boolean {
|
||||
startsWith(path: string): boolean {
|
||||
return this.pathname.startsWith(this.makePath(path))
|
||||
}
|
||||
|
||||
@ -39,18 +39,10 @@ export class PathCheckTool {
|
||||
* @param {string} path - 要检查的路径。
|
||||
* @returns {boolean} 如果完整路径与基础 URL 的路径精确匹配则返回 true,否则返回 false。
|
||||
*/
|
||||
fullCheck(path: string): boolean {
|
||||
full(path: string): boolean {
|
||||
return this.pathname === path
|
||||
}
|
||||
|
||||
/**
|
||||
* 更换路径前缀。
|
||||
* @param {string} newPrefix - 新的路径前缀。
|
||||
*/
|
||||
changePrefix(newPrefix: string): void {
|
||||
this.prefix = newPrefix
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建一个子工具,继承当前工具的 URL 和前缀。
|
||||
* @param {string} [childPrefix] - 子工具的路径前缀。
|
||||
|
Loading…
x
Reference in New Issue
Block a user