All checks were successful
CI Monitor MIflow / build-image (push) Successful in 38s
10 lines
309 B
TypeScript
10 lines
309 B
TypeScript
export const makeCheckPathTool = (url: string, prefix?: string) => {
|
|
const { pathname } = new URL(url)
|
|
return {
|
|
// 精确匹配
|
|
exactCheck: (path: string) => pathname === `${prefix}${path}`,
|
|
// 前缀匹配
|
|
startsWithCheck: (path: string) => pathname.startsWith(`${prefix}${path}`),
|
|
}
|
|
}
|