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

visgl / loaders.gl / 24112850045

08 Apr 2026 01:31AM UTC coverage: 35.137% (+0.003%) from 35.134%
24112850045

push

github

web-flow
chore: biome replaces eslint/prettier (#3349)

1225 of 2057 branches covered (59.55%)

Branch coverage included in aggregate %.

55 of 603 new or added lines in 172 files covered. (9.12%)

1 existing line in 1 file now uncovered.

39942 of 115105 relevant lines covered (34.7%)

0.77 hits per line

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

39.66
/modules/json/src/lib/encoder-utils/encode-utils.ts
1
// loaders.gl
1✔
2
// SPDX-License-Identifier: MIT
1✔
3
// Copyright (c) vis.gl contributors
1✔
4
// Copyright 2022 Foursquare Labs, Inc.
1✔
5

1✔
6
import type {Table} from '@loaders.gl/schema';
1✔
7
import {getTableLength, getTableNumCols, getTableRowAsArray} from '@loaders.gl/schema-utils';
1✔
8

1✔
9
type Row = {[key: string]: unknown};
1✔
10

1✔
11
/**
1✔
12
 * Attempts to identify which column contains geometry
1✔
13
 * Currently just returns name (key) of first object-valued column
1✔
14
 * @todo look for hints in schema metadata
1✔
15
 * @todo look for WKB
1✔
16
 */
1✔
17
export function detectGeometryColumnIndex(table: Table): number {
1✔
18
  // TODO - look for hints in schema metadata
×
19

×
20
  // look for a column named geometry
×
NEW
21
  const geometryIndex = table.schema?.fields.findIndex(field => field.name === 'geometry') ?? -1;
×
22
  if (geometryIndex > -1) {
×
23
    return geometryIndex;
×
24
  }
×
25

×
26
  // look at the data
×
27
  // TODO - this drags in the indices
×
28
  if (getTableLength(table) > 0) {
×
29
    const row = getTableRowAsArray(table, 0);
×
30
    for (let columnIndex = 0; columnIndex < getTableNumCols(table); columnIndex++) {
×
31
      const value = row?.[columnIndex];
×
32
      if (value && typeof value === 'object') {
×
33
        return columnIndex;
×
34
      }
×
35
    }
×
36
  }
×
37

×
38
  throw new Error('Failed to detect geometry column');
×
39
}
×
40

1✔
41
/**
1✔
42
 * Return a row as a property (key/value) object, excluding selected columns
1✔
43
 */
1✔
44
export function getRowPropertyObject(
1✔
45
  table: Table,
×
46
  row: Row,
×
47
  excludeColumnIndices: number[] = []
×
48
): {[columnName: string]: unknown} {
×
49
  const properties = {};
×
50
  for (let columnIndex = 0; columnIndex < getTableNumCols(table); ++columnIndex) {
×
51
    const columnName = table.schema?.fields[columnIndex].name;
×
52
    if (columnName && !excludeColumnIndices.includes(columnIndex)) {
×
53
      properties[columnName] = row[columnName];
×
54
    }
×
55
  }
×
56
  return properties;
×
57
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc