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

visgl / luma.gl / 23357510199

20 Mar 2026 06:40PM UTC coverage: 58.158% (+5.9%) from 52.213%
23357510199

push

github

web-flow
chore: Run tests on src instead of dist (#2555)

3021 of 6029 branches covered (50.11%)

Branch coverage included in aggregate %.

7102 of 11377 relevant lines covered (62.42%)

243.33 hits per line

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

52.17
/modules/engine/src/utils/buffer-layout-helper.ts
1
// luma.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
import {log, type BufferLayout} from '@luma.gl/core';
6

7
/** BufferLayoutHelper is a helper class that should not be used directly by applications */
8
export class BufferLayoutHelper {
9
  bufferLayouts: BufferLayout[];
10

11
  constructor(bufferLayouts: BufferLayout[]) {
12
    this.bufferLayouts = bufferLayouts;
143✔
13
  }
14

15
  getBufferLayout(name: string): BufferLayout | null {
16
    return this.bufferLayouts.find(layout => layout.name === name) || null;
683!
17
  }
18

19
  /** Get attribute names from a BufferLayout */
20
  getAttributeNamesForBuffer(bufferLayout: BufferLayout): string[] {
21
    return bufferLayout.attributes
229!
22
      ? bufferLayout.attributes?.map(layout => layout.attribute)
×
23
      : [bufferLayout.name];
24
  }
25

26
  mergeBufferLayouts(
27
    bufferLayouts1: BufferLayout[],
28
    bufferLayouts2: BufferLayout[]
29
  ): BufferLayout[] {
30
    const mergedLayouts = [...bufferLayouts1];
24✔
31
    for (const attribute of bufferLayouts2) {
24✔
32
      const index = mergedLayouts.findIndex(attribute2 => attribute2.name === attribute.name);
288✔
33
      if (index < 0) {
64!
34
        mergedLayouts.push(attribute);
64✔
35
      } else {
36
        mergedLayouts[index] = attribute;
×
37
      }
38
    }
39
    return mergedLayouts;
24✔
40
  }
41

42
  getBufferIndex(bufferName: string): number {
43
    const bufferIndex = this.bufferLayouts.findIndex(layout => layout.name === bufferName);
×
44

45
    if (bufferIndex === -1) {
×
46
      log.warn(`BufferLayout: Missing buffer for "${bufferName}".`)();
×
47
    }
48

49
    return bufferIndex;
×
50
  }
51
}
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