• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

keplergl / kepler.gl / 14430112347

13 Apr 2025 01:53PM UTC coverage: 61.717% (-4.4%) from 66.129%
14430112347

Pull #3048

github

web-flow
Merge 4d33fb563 into 9de30e2ba
Pull Request #3048: [feat] Raster Tile Layer

6066 of 11656 branches covered (52.04%)

Branch coverage included in aggregate %.

136 of 1263 new or added lines in 45 files covered. (10.77%)

5 existing lines in 3 files now uncovered.

12551 of 18509 relevant lines covered (67.81%)

82.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.19
/src/common-utils/src/url.ts
1
// SPDX-License-Identifier: MIT
2
// Copyright contributors to the kepler.gl project
3

4
/**
5
 * Allows to break down a url into multiple params
6
 * from http://blog.stevenlevithan.com/archives/parseuri
7
 */
8
export function parseUri(str: string): {[key: string]: any} {
9
  const o = parseUri.options;
43✔
10
  const m = o.parser[o.strictMode ? 'strict' : 'loose'].exec(str);
43!
11
  const uri = {};
43✔
12
  let i = 14;
43✔
13

14
  while (i--) uri[o.key[i]] = m?.[i] || '';
602✔
15

16
  uri[o.q.name] = {};
43✔
17
  uri[o.key[12]].replace(o.q.parser, ($0, $1, $2) => {
43✔
18
    if ($1) uri[o.q.name][$1] = $2;
43✔
19
  });
20

21
  return uri;
43✔
22
}
23

24
parseUri.options = {
15✔
25
  strictMode: false,
26
  key: [
27
    'source',
28
    'protocol',
29
    'authority',
30
    'userInfo',
31
    'user',
32
    'password',
33
    'host',
34
    'port',
35
    'relative',
36
    'path',
37
    'directory',
38
    'file',
39
    'query',
40
    'anchor'
41
  ],
42
  q: {
43
    name: 'queryKey',
44
    parser: /(?:^|&)([^&=]*)=?([^&]*)/g
45
  },
46
  parser: {
47
    strict:
48
      // eslint-disable-next-line no-useless-escape
49
      /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
50
    loose:
51
      // eslint-disable-next-line no-useless-escape
52
      /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/
53
  }
54
};
55

56
/**
57
 * Validates an url
58
 * @param str
59
 */
60
export function validateUrl(str) {
NEW
61
  try {
×
NEW
62
    new URL(str);
×
NEW
63
    return true;
×
64
  } catch {
NEW
65
    return false;
×
66
  }
67
}
68

69
/**
70
 * Checks whether a given URL points to a PMTiles file.
71
 * @param url The URL to check.
72
 * @returns True if the URL includes '.pmtiles', otherwise false.
73
 */
74
export const isPMTilesUrl = (url?: string | null) => url?.includes('.pmtiles');
15✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc