|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
1.0 KB
|
| Line | |
|---|
| 1 | /*
|
|---|
| 2 | Copyright 2018 Google LLC
|
|---|
| 3 |
|
|---|
| 4 | Use of this source code is governed by an MIT-style
|
|---|
| 5 | license that can be found in the LICENSE file or at
|
|---|
| 6 | https://opensource.org/licenses/MIT.
|
|---|
| 7 | */
|
|---|
| 8 |
|
|---|
| 9 | import '../_version.js';
|
|---|
| 10 |
|
|---|
| 11 | /**
|
|---|
| 12 | * Removes any URL search parameters that should be ignored.
|
|---|
| 13 | *
|
|---|
| 14 | * @param {URL} urlObject The original URL.
|
|---|
| 15 | * @param {Array<RegExp>} ignoreURLParametersMatching RegExps to test against
|
|---|
| 16 | * each search parameter name. Matches mean that the search parameter should be
|
|---|
| 17 | * ignored.
|
|---|
| 18 | * @return {URL} The URL with any ignored search parameters removed.
|
|---|
| 19 | *
|
|---|
| 20 | * @private
|
|---|
| 21 | * @memberof workbox-precaching
|
|---|
| 22 | */
|
|---|
| 23 | export function removeIgnoredSearchParams(
|
|---|
| 24 | urlObject: URL,
|
|---|
| 25 | ignoreURLParametersMatching: RegExp[] = [],
|
|---|
| 26 | ): URL {
|
|---|
| 27 | // Convert the iterable into an array at the start of the loop to make sure
|
|---|
| 28 | // deletion doesn't mess up iteration.
|
|---|
| 29 | for (const paramName of [...urlObject.searchParams.keys()]) {
|
|---|
| 30 | if (ignoreURLParametersMatching.some((regExp) => regExp.test(paramName))) {
|
|---|
| 31 | urlObject.searchParams.delete(paramName);
|
|---|
| 32 | }
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | return urlObject;
|
|---|
| 36 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.