UNPKG

edge-master

Version:
2 lines (1 loc) 374 B
"use strict";export const routePattern=t=>{const r=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),e=new RegExp("^".concat(r.replace(/\\\*/g,".*"),"$"));return n=>e.test(n.url)},urlStartWith=t=>r=>r.url.startsWith(t),pathStartWith=t=>r=>new URL(r.url).pathname.startsWith(t),httpMethod=t=>r=>r.method===t.toUpperCase(),and=(...t)=>r=>t.every(e=>e(r)),or=(...t)=>r=>t.some(e=>e(r));