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

visgl / loaders.gl / 20352515932

18 Dec 2025 09:56PM UTC coverage: 35.115% (-28.4%) from 63.485%
20352515932

push

github

web-flow
feat(loader-utils): Export is-type helpers (#3258)

1188 of 1998 branches covered (59.46%)

Branch coverage included in aggregate %.

147 of 211 new or added lines in 13 files covered. (69.67%)

30011 existing lines in 424 files now uncovered.

37457 of 108056 relevant lines covered (34.66%)

0.79 hits per line

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

80.0
/modules/mvt/src/tilejson-loader.ts
1
// loaders.gl
1✔
2
// SPDX-License-Identifier: MIT
1✔
3
// Copyright (c) vis.gl contributors
1✔
4

1✔
5
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
1✔
6
import type {TileJSON} from './lib/parse-tilejson';
1✔
7
import {parseTileJSON} from './lib/parse-tilejson';
1✔
8

1✔
9
// __VERSION__ is injected by babel-plugin-version-inline
1✔
10
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
1✔
11
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'latest';
1!
12

1✔
13
export type TileJSONLoaderOptions = LoaderOptions & {
1✔
14
  /** Options for the TileJSONLoader */
1✔
15
  tilejson?: {
1✔
16
    /** Max number of unique values */
1✔
17
    maxValues?: number;
1✔
18
  };
1✔
19
};
1✔
20

1✔
21
/**
1✔
22
 * Loader for TileJSON metadata
1✔
23
 */
1✔
24
export const TileJSONLoader = {
1✔
25
  dataType: null as unknown as TileJSON,
1✔
26
  batchType: null as never,
1✔
27

1✔
28
  name: 'TileJSON',
1✔
29
  id: 'tilejson',
1✔
30
  module: 'pmtiles',
1✔
31
  version: VERSION,
1✔
32
  worker: true,
1✔
33
  extensions: ['json'],
1✔
34
  mimeTypes: ['application/json'],
1✔
35
  text: true,
1✔
36
  options: {
1✔
37
    tilejson: {
1✔
38
      maxValues: undefined
1✔
39
    }
1✔
40
  },
1✔
41
  parse: async (arrayBuffer: ArrayBuffer, options?: TileJSONLoaderOptions) => {
1✔
UNCOV
42
    const jsonString = new TextDecoder().decode(arrayBuffer);
×
UNCOV
43
    const json = JSON.parse(jsonString);
×
UNCOV
44
    const tilejsonOptions = {...TileJSONLoader.options.tilejson, ...options?.tilejson};
×
UNCOV
45
    return parseTileJSON(json, tilejsonOptions) as TileJSON;
×
UNCOV
46
  },
×
47
  parseTextSync: (text: string, options?: TileJSONLoaderOptions) => {
1✔
UNCOV
48
    const json = JSON.parse(text);
×
UNCOV
49
    const tilejsonOptions = {...TileJSONLoader.options.tilejson, ...options?.tilejson};
×
UNCOV
50
    return parseTileJSON(json, tilejsonOptions) as TileJSON;
×
UNCOV
51
  }
×
52
} as const satisfies LoaderWithParser<TileJSON, never, TileJSONLoaderOptions>;
1✔
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