source: frontend/node_modules/workbox-precaching/utils/removeIgnoredSearchParams.js

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*/
8import '../_version.js';
9/**
10 * Removes any URL search parameters that should be ignored.
11 *
12 * @param {URL} urlObject The original URL.
13 * @param {Array<RegExp>} ignoreURLParametersMatching RegExps to test against
14 * each search parameter name. Matches mean that the search parameter should be
15 * ignored.
16 * @return {URL} The URL with any ignored search parameters removed.
17 *
18 * @private
19 * @memberof workbox-precaching
20 */
21export function removeIgnoredSearchParams(urlObject, ignoreURLParametersMatching = []) {
22 // Convert the iterable into an array at the start of the loop to make sure
23 // deletion doesn't mess up iteration.
24 for (const paramName of [...urlObject.searchParams.keys()]) {
25 if (ignoreURLParametersMatching.some((regExp) => regExp.test(paramName))) {
26 urlObject.searchParams.delete(paramName);
27 }
28 }
29 return urlObject;
30}
Note: See TracBrowser for help on using the repository browser.