• 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/xml/src/xml-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 {ParseXMLOptions} from './lib/parsers/parse-xml';
1✔
7
import {parseXMLSync} from './lib/parsers/parse-xml';
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 XMLLoaderOptions = LoaderOptions & {
1✔
14
  xml?: ParseXMLOptions;
1✔
15
};
1✔
16

1✔
17
/**
1✔
18
 * Loader for XML files
1✔
19
 */
1✔
20
export const XMLLoader = {
1✔
21
  dataType: null as any,
1✔
22
  batchType: null as never,
1✔
23
  name: 'XML',
1✔
24
  id: 'xml',
1✔
25
  module: 'xml',
1✔
26
  version: VERSION,
1✔
27
  worker: false,
1✔
28
  extensions: ['xml'],
1✔
29
  mimeTypes: ['application/xml', 'text/xml'],
1✔
30
  testText: testXMLFile,
1✔
31
  options: {
1✔
32
    xml: {
1✔
33
      _parser: 'fast-xml-parser',
1✔
34
      uncapitalizeKeys: false,
1✔
35
      removeNSPrefix: false,
1✔
36
      textNodeName: 'value',
1✔
37
      arrayPaths: []
1✔
38
    }
1✔
39
  },
1✔
40
  parse: async (arrayBuffer: ArrayBuffer, options?: XMLLoaderOptions) =>
1✔
41
    parseXMLSync(new TextDecoder().decode(arrayBuffer), {
×
42
      ...XMLLoader.options.xml,
×
43
      ...options?.xml
×
44
    }),
×
45
  parseTextSync: (text: string, options?: XMLLoaderOptions) =>
1✔
UNCOV
46
    parseXMLSync(text, {...XMLLoader.options.xml, ...options?.xml})
×
47
} as const satisfies LoaderWithParser<any, never, XMLLoaderOptions>;
1✔
48

1✔
49
function testXMLFile(text: string): boolean {
×
50
  // TODO - There could be space first.
×
51
  return text.startsWith('<?xml');
×
52
}
×
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