1 | ;
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.isUrlIgnored = exports.urlMatches = void 0;
|
4 | /*
|
5 | * Copyright The OpenTelemetry Authors
|
6 | *
|
7 | * Licensed under the Apache License, Version 2.0 (the "License");
|
8 | * you may not use this file except in compliance with the License.
|
9 | * You may obtain a copy of the License at
|
10 | *
|
11 | * https://www.apache.org/licenses/LICENSE-2.0
|
12 | *
|
13 | * Unless required by applicable law or agreed to in writing, software
|
14 | * distributed under the License is distributed on an "AS IS" BASIS,
|
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
16 | * See the License for the specific language governing permissions and
|
17 | * limitations under the License.
|
18 | */
|
19 | function urlMatches(url, urlToMatch) {
|
20 | if (typeof urlToMatch === 'string') {
|
21 | return url === urlToMatch;
|
22 | }
|
23 | else {
|
24 | return !!url.match(urlToMatch);
|
25 | }
|
26 | }
|
27 | exports.urlMatches = urlMatches;
|
28 | /**
|
29 | * Check if {@param url} should be ignored when comparing against {@param ignoredUrls}
|
30 | * @param url
|
31 | * @param ignoredUrls
|
32 | */
|
33 | function isUrlIgnored(url, ignoredUrls) {
|
34 | if (!ignoredUrls) {
|
35 | return false;
|
36 | }
|
37 | for (const ignoreUrl of ignoredUrls) {
|
38 | if (urlMatches(url, ignoreUrl)) {
|
39 | return true;
|
40 | }
|
41 | }
|
42 | return false;
|
43 | }
|
44 | exports.isUrlIgnored = isUrlIgnored;
|
45 | //# sourceMappingURL=url.js.map |
\ | No newline at end of file |