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

visgl / loaders.gl / 24139120841

08 Apr 2026 01:53PM UTC coverage: 65.319% (+30.2%) from 35.137%
24139120841

push

github

web-flow
chore: Replace puppeteer with playwright (#3350)

14216 of 18890 branches covered (75.26%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 1 file covered. (100.0%)

3248 existing lines in 369 files now uncovered.

73509 of 115413 relevant lines covered (63.69%)

5763.45 hits per line

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

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

1✔
5
import type {Table, TableBatch, Batch} from '@loaders.gl/schema';
1✔
6
import type {LoaderWithParser, LoaderOptions} from '@loaders.gl/loader-utils';
1✔
7
import {parseJSONSync} from './lib/parsers/parse-json';
1✔
8
import {parseJSONInBatches} from './lib/parsers/parse-json-in-batches';
1✔
9

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

1✔
14
export type MetadataBatch = Batch & {
1✔
15
  shape: 'metadata';
1✔
16
};
1✔
17

1✔
18
export type JSONBatch = Batch & {
1✔
19
  shape: 'json';
1✔
20
  /** JSON data */
1✔
21
  container: any;
1✔
22
};
1✔
23

1✔
24
/**
1✔
25
 * @param table -
1✔
26
 * @param jsonpaths -
1✔
27
 */
1✔
28
export type JSONLoaderOptions = LoaderOptions & {
1✔
29
  json?: {
1✔
30
    /** Not specifying shape leaves avoids changes */
1✔
31
    shape?: 'object-row-table' | 'array-row-table';
1✔
32
    table?: boolean;
1✔
33
    jsonpaths?: string[];
1✔
34
  };
1✔
35
};
1✔
36

1✔
37
export const JSONLoader = {
1✔
38
  dataType: null as unknown as Table,
1✔
39
  batchType: null as unknown as TableBatch | MetadataBatch | JSONBatch,
1✔
40

1✔
41
  name: 'JSON',
1✔
42
  id: 'json',
1✔
43
  module: 'json',
1✔
44
  version: VERSION,
1✔
45
  extensions: ['json', 'geojson'],
1✔
46
  mimeTypes: ['application/json'],
1✔
47
  category: 'table',
1✔
48
  text: true,
1✔
49
  options: {
1✔
50
    json: {
1✔
51
      shape: undefined,
1✔
52
      table: false,
1✔
53
      jsonpaths: []
1✔
54
      // batchSize: 'auto'
6✔
55
    }
6✔
56
  },
6✔
57
  parse,
6✔
58
  parseTextSync,
6✔
59
  parseInBatches
6✔
60
} as const satisfies LoaderWithParser<
6✔
61
  Table,
6✔
62
  TableBatch | MetadataBatch | JSONBatch,
6✔
63
  JSONLoaderOptions
6✔
64
>;
6✔
65

6✔
66
async function parse(arrayBuffer: ArrayBuffer, options?: JSONLoaderOptions) {
1✔
67
  return parseTextSync(new TextDecoder().decode(arrayBuffer), options);
1✔
68
}
7✔
69

7✔
70
function parseTextSync(text: string, options?: JSONLoaderOptions) {
5✔
71
  const jsonOptions = {...options, json: {...JSONLoader.options.json, ...options?.json}};
5✔
72
  return parseJSONSync(text, jsonOptions as JSONLoaderOptions);
5✔
73
}
5✔
74

1✔
75
function parseInBatches(
7✔
76
  asyncIterator:
7✔
77
    | AsyncIterable<ArrayBufferLike | ArrayBufferView>
7✔
78
    | Iterable<ArrayBufferLike | ArrayBufferView>,
7✔
79
  options?: JSONLoaderOptions
7✔
80
): AsyncIterable<TableBatch | MetadataBatch | JSONBatch> {
7✔
81
  const jsonOptions = {...options, json: {...JSONLoader.options.json, ...options?.json}};
7✔
82
  return parseJSONInBatches(asyncIterator, jsonOptions as JSONLoaderOptions);
7✔
83
}
7✔
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