• 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

77.17
/modules/schema-utils/src/lib/table/batch-builder/base-table-batch-aggregator.ts
1
// loaders.gl
1✔
2
// SPDX-License-Identifier: MIT
1✔
3
// Copyright (c) vis.gl contributors
1✔
4

1✔
5
import type {Schema, TableBatch} from '@loaders.gl/schema';
1✔
6
import {TableBatchAggregator, TableBatchOptions} from './table-batch-aggregator';
1✔
7

1✔
8
const DEFAULT_ROW_COUNT = 100;
1✔
9

1✔
10
export class BaseTableBatchAggregator implements TableBatchAggregator {
1✔
11
  schema: Schema;
1✔
12
  options: TableBatchOptions;
4✔
13

4✔
14
  shape?: 'array-row-table' | 'object-row-table';
4✔
15
  length: number = 0;
4✔
16
  rows: any[] | null = null;
4✔
17
  cursor: number = 0;
4✔
18
  private _headers: string[] = [];
4✔
19

1✔
20
  constructor(schema: Schema, options: TableBatchOptions) {
1✔
21
    this.options = options;
4✔
22
    this.schema = schema;
4✔
23

4✔
24
    // schema is an array if there're no headers
4✔
25
    // object if there are headers
4✔
26
    if (!Array.isArray(schema)) {
4✔
27
      this._headers = [];
4✔
28
      for (const key in schema) {
4!
29
        this._headers[schema[key].index] = schema[key].name;
×
30
      }
×
31
    }
×
32
  }
4✔
33

1✔
34
  rowCount(): number {
1✔
35
    return this.length;
4✔
36
  }
4✔
37

1✔
38
  addArrayRow(row: any[], cursor?: number): void {
1✔
UNCOV
39
    if (Number.isFinite(cursor)) {
×
40
      this.cursor = cursor as number;
×
41
    }
×
UNCOV
42

×
UNCOV
43
    this.shape = 'array-row-table';
×
UNCOV
44

×
UNCOV
45
    this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
×
UNCOV
46
    this.rows[this.length] = row;
×
UNCOV
47
    this.length++;
×
UNCOV
48
  }
×
49

1✔
50
  addObjectRow(row: {[columnName: string]: any}, cursor?: number): void {
1✔
51
    if (Number.isFinite(cursor)) {
4!
52
      this.cursor = cursor as number;
×
53
    }
×
54

4✔
55
    this.shape = 'object-row-table';
4✔
56

4✔
57
    this.rows = this.rows || new Array(DEFAULT_ROW_COUNT);
4✔
58
    this.rows[this.length] = row;
4✔
59
    this.length++;
4✔
60
  }
4✔
61

1✔
62
  getBatch(): TableBatch | null {
1✔
63
    let rows = this.rows;
4✔
64
    if (!rows) {
4!
65
      return null;
×
66
    }
×
67

4✔
68
    rows = rows.slice(0, this.length);
4✔
69
    this.rows = null;
4✔
70

4✔
71
    const batch: TableBatch = {
4✔
72
      shape: this.shape || 'array-row-table',
4!
73
      batchType: 'data',
4✔
74
      data: rows,
4✔
75
      length: this.length,
4✔
76
      schema: this.schema,
4✔
77
      cursor: this.cursor
4✔
78
    };
4✔
79

4✔
80
    return batch;
4✔
81
  }
4✔
82
}
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