@opentelemetry/core
Version:
OpenTelemetry Core provides constants and utilities shared by all OpenTelemetry SDK packages.
20 lines (19 loc) • 588 B
JavaScript
//#region src/utils/url.ts
function urlMatches(url, urlToMatch) {
if (typeof urlToMatch === "string") return url === urlToMatch;
else return !!url.match(urlToMatch);
}
/**
* Check if {@param url} should be ignored when comparing against {@param ignoredUrls}
* @param url
* @param ignoredUrls
*/
function isUrlIgnored(url, ignoredUrls) {
if (!ignoredUrls) return false;
for (const ignoreUrl of ignoredUrls) if (urlMatches(url, ignoreUrl)) return true;
return false;
}
//#endregion
exports.isUrlIgnored = isUrlIgnored;
exports.urlMatches = urlMatches;
//# sourceMappingURL=url.cjs.map