• 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

26.09
/modules/obj/src/lib/get-obj-schema.ts
1
// loaders.gl
1✔
2
// SPDX-License-Identifier: MIT
1✔
3
// Copyright (c) vis.gl contributors
1✔
4

1✔
5
import type {Schema, SchemaMetadata, Field, MeshAttribute} from '@loaders.gl/schema';
1✔
6
import {getDataTypeFromArray} from '@loaders.gl/schema-utils';
1✔
7

1✔
8
/** Get Mesh Schema */
1✔
9
export function getOBJSchema(
1✔
UNCOV
10
  attributes: Record<string, MeshAttribute>,
×
UNCOV
11
  metadata: Record<string, unknown> = {}
×
UNCOV
12
): Schema {
×
UNCOV
13
  const stringMetadata: SchemaMetadata = {};
×
UNCOV
14
  for (const key in metadata) {
×
UNCOV
15
    if (key !== 'value') {
×
UNCOV
16
      stringMetadata[key] = JSON.stringify(metadata[key]);
×
UNCOV
17
    }
×
UNCOV
18
  }
×
UNCOV
19

×
UNCOV
20
  const fields: Field[] = [];
×
UNCOV
21
  for (const attributeName in attributes) {
×
UNCOV
22
    const attribute = attributes[attributeName];
×
UNCOV
23
    const field = getFieldFromAttribute(attributeName, attribute);
×
UNCOV
24
    fields.push(field);
×
UNCOV
25
  }
×
UNCOV
26

×
UNCOV
27
  return {fields, metadata: stringMetadata};
×
UNCOV
28
}
×
29

1✔
30
/** Get a Field describing the column from an OBJ attribute */
1✔
UNCOV
31
function getFieldFromAttribute(name: string, attribute: MeshAttribute): Field {
×
UNCOV
32
  const metadata: Record<string, string> = {};
×
UNCOV
33
  for (const key in attribute) {
×
UNCOV
34
    if (key !== 'value') {
×
UNCOV
35
      metadata[key] = JSON.stringify(attribute[key]);
×
UNCOV
36
    }
×
UNCOV
37
  }
×
UNCOV
38

×
UNCOV
39
  let {type} = getDataTypeFromArray(attribute.value);
×
UNCOV
40
  const isSingleValue = attribute.size === 1 || attribute.size === undefined;
×
UNCOV
41
  if (!isSingleValue) {
×
UNCOV
42
    type = {type: 'fixed-size-list', listSize: attribute.size, children: [{name: 'values', type}]};
×
UNCOV
43
  }
×
UNCOV
44
  return {name, type, nullable: false, metadata};
×
UNCOV
45
}
×
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