• 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

59.18
/modules/xml/src/html-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} from '@loaders.gl/loader-utils';
1✔
6
import {mergeOptions} from '@loaders.gl/loader-utils';
1✔
7
import {XMLLoader, XMLLoaderOptions} from './xml-loader';
1✔
8

1✔
9
export type HTMLLoaderOptions = XMLLoaderOptions;
1✔
10

1✔
11
/**
1✔
12
 * Loader for HTML files
1✔
13
 * Essentially a copy of the XMLLoader with different mime types, file extensions and content tests.
1✔
14
 * This split enables applications can control whether they want HTML responses to be parsed by the XML loader or not.
1✔
15
 * This loader does not have any additional understanding of the structure of HTML or the document.
1✔
16
 */
1✔
17
export const HTMLLoader = {
1✔
18
  ...XMLLoader,
1✔
19
  name: 'HTML',
1✔
20
  id: 'html',
1✔
21
  extensions: ['html', 'htm'],
1✔
22
  mimeTypes: ['text/html'],
1✔
23
  testText: testHTMLFile,
1✔
24
  parse: async (arrayBuffer: ArrayBuffer, options?: XMLLoaderOptions) =>
1✔
25
    parseTextSync(new TextDecoder().decode(arrayBuffer), options),
×
26
  parseTextSync: (text: string, options?: XMLLoaderOptions) => parseTextSync(text, options)
1✔
27
} as const satisfies LoaderWithParser<any, never, HTMLLoaderOptions>;
1✔
28

1✔
29
function testHTMLFile(text: string): boolean {
×
30
  // TODO - There could be space first.
×
31
  return text.startsWith('<html');
×
32
}
×
33

1✔
UNCOV
34
function parseTextSync(text: string, options?: XMLLoaderOptions): any {
×
UNCOV
35
  // fast-xml-parser can recognize HTML entities
×
UNCOV
36
  // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/2.XMLparseOptions.md#htmlentities
×
UNCOV
37
  // https://github.com/NaturalIntelligence/fast-xml-parser/blob/master/docs/v4/5.Entities.md
×
UNCOV
38
  options = mergeOptions(options, {
×
UNCOV
39
    xml: {
×
UNCOV
40
      _parser: 'fast-xml-parser',
×
UNCOV
41
      _fastXML: {
×
UNCOV
42
        htmlEntities: true
×
UNCOV
43
      }
×
UNCOV
44
    }
×
UNCOV
45
  });
×
UNCOV
46

×
UNCOV
47
  return XMLLoader.parseTextSync?.(text, options);
×
UNCOV
48
}
×
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