qsu
Version:
qsu is a utility library that contains useful and frequently used functions. Start with your preferred language and the modern development environment.
1 lines • 305 B
JavaScript
export function isMatchPathname(t,e){if(!t||!e||e?.length<1)throw new Error("`url` and `matcher` must be set");const r="string"==typeof e?[e]:e,n=t.split("?")[0].replace(/\/$/,"");return r.some((t=>{if("*"===t||"/*"===t)return!0;const e=t.replace(/\*$/,"");return t.endsWith("*")?n.startsWith(e):e===n}))}