• 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

35.94
/modules/netcdf/src/netcdfjs/read-data.ts
1
import type {IOBuffer} from '../iobuffer/iobuffer';
1✔
2
import type {NetCDFRecordDimension, NetCDFVariable} from './netcdf-types';
1✔
3
import {readType, str2num, num2bytes} from './read-type';
1✔
4

1✔
5
// const STREAMING = 4294967295;
1✔
6

1✔
7
/**
1✔
8
 * Read data for the given non-record variable
1✔
9
 * @param buffer - Buffer for the file data
1✔
10
 * @param variable - Variable metadata
1✔
11
 * @return Data of the element
1✔
12
 */
1✔
13
export function readNonRecord(
1✔
UNCOV
14
  buffer: IOBuffer,
×
UNCOV
15
  variable: NetCDFVariable
×
UNCOV
16
): (string | number | number[] | Uint8Array)[] {
×
UNCOV
17
  // variable type
×
UNCOV
18
  const type = str2num(variable.type);
×
UNCOV
19

×
UNCOV
20
  // size of the data
×
UNCOV
21
  const size = variable.size / num2bytes(type);
×
UNCOV
22

×
UNCOV
23
  // iterates over the data
×
UNCOV
24
  const data = new Array(size);
×
UNCOV
25
  for (let i = 0; i < size; i++) {
×
UNCOV
26
    data[i] = readType(buffer, type, 1);
×
UNCOV
27
  }
×
UNCOV
28

×
UNCOV
29
  return data;
×
UNCOV
30
}
×
31

1✔
32
/**
1✔
33
 * Read data for the given record variable
1✔
34
 * @param buffer - Buffer for the file data
1✔
35
 * @param variable - Variable metadata
1✔
36
 * @param recordDimension - Record dimension metadata
1✔
37
 * @return - Data of the element
1✔
38
 */
1✔
39
export function readRecord(
1✔
UNCOV
40
  buffer: IOBuffer,
×
UNCOV
41
  variable: NetCDFVariable,
×
UNCOV
42
  recordDimension: NetCDFRecordDimension
×
UNCOV
43
): (string | number | number[] | Uint8Array)[] {
×
UNCOV
44
  // variable type
×
UNCOV
45
  const type = str2num(variable.type);
×
UNCOV
46
  const width = variable.size ? variable.size / num2bytes(type) : 1;
×
UNCOV
47

×
UNCOV
48
  // size of the data
×
UNCOV
49
  // TODO streaming data
×
UNCOV
50
  const size = recordDimension.length;
×
UNCOV
51

×
UNCOV
52
  // iterates over the data
×
UNCOV
53
  const data = new Array(size);
×
UNCOV
54
  const step = recordDimension.recordStep;
×
UNCOV
55

×
UNCOV
56
  for (let i = 0; i < size; i++) {
×
UNCOV
57
    const currentOffset = buffer.offset;
×
UNCOV
58
    data[i] = readType(buffer, type, width);
×
UNCOV
59
    buffer.seek(currentOffset + step);
×
UNCOV
60
  }
×
UNCOV
61

×
UNCOV
62
  return data;
×
UNCOV
63
}
×
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