liefern
Version:
Node Webserver without dependencies
19 lines • 504 B
JavaScript
const handler = (url, pattern) => {
const regex = new RegExp(`^${pattern}$`, 'g');
const results = [];
let match;
let matched = false;
while ((match = regex.exec(url)) !== null) {
matched = true;
results.push(...match.slice(1));
}
if (!matched) {
return false;
}
return results.map((item) => decodeURIComponent(item));
};
export const regexUrlMatcher = {
handler,
chatchAllIndicator: '.*',
};
//# sourceMappingURL=regexUrlMatcher.js.map