• 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

82.35
/modules/core/src/utils/array-equal.ts
1
// luma.gl
2
// SPDX-License-Identifier: MIT
3
// Copyright (c) vis.gl contributors
4

5
import {isNumberArray} from './is-array';
6

7
const MAX_ELEMENTWISE_ARRAY_COMPARE_LENGTH = 128;
71✔
8

9
/** Test if two arrays are deep equal, with a small-array length limit that defaults to 16 */
10
export function arrayEqual(a: unknown, b: unknown, limit: number = 16) {
141✔
11
  if (a === b) {
141✔
12
    return true;
22✔
13
  }
14

15
  const arrayA = a;
119✔
16
  const arrayB = b;
119✔
17
  if (!isNumberArray(arrayA) || !isNumberArray(arrayB)) {
119✔
18
    return false;
116✔
19
  }
20

21
  if (arrayA.length !== arrayB.length) {
3!
22
    return false;
×
23
  }
24

25
  const maxCompareLength = Math.min(limit, MAX_ELEMENTWISE_ARRAY_COMPARE_LENGTH);
3✔
26
  if (arrayA.length > maxCompareLength) {
3!
27
    return false;
×
28
  }
29

30
  for (let i = 0; i < arrayA.length; ++i) {
3✔
31
    if (arrayB[i] !== arrayA[i]) {
48!
32
      return false;
×
33
    }
34
  }
35

36
  return true;
3✔
37
}
38

39
/** Copy a value */
40
export function arrayCopy<T>(a: T): T {
41
  if (isNumberArray(a)) {
116✔
42
    return a.slice() as T;
82✔
43
  }
44
  return a;
34✔
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