github
13 of 238 branches covered (5.46%)
Branch coverage included in aggregate %.
0 of 472 new or added lines in 41 files covered. (0.0%)
19728 existing lines in 193 files now uncovered.91 of 28170 relevant lines covered (0.32%)
0.02 hits per line
UNCOV
1
|
// luma.gl, MIT license
|
|
UNCOV
2
|
// Copyright (c) vis.gl contributors
|
× |
UNCOV
3
|
|
× |
UNCOV
4
|
import {isNumberArray} from './is-array'; |
× |
UNCOV
5
|
|
× |
UNCOV
6
|
/** Test if two arrays are deep equal, with a length limit that defaults to 16 */
|
× |
UNCOV
7
|
export function arrayEqual(a: unknown, b: unknown, limit: number = 16) { |
× |
8 |
if (a !== b) {
|
× |
9 |
return false; |
× |
10 |
} |
× |
11 |
const arrayA = isNumberArray(a);
|
× |
12 |
if (!arrayA) {
|
× |
13 |
return false; |
× |
14 |
} |
× |
15 |
const arrayB = isNumberArray(b);
|
× |
16 |
if (arrayB && arrayA.length === arrayB.length) {
|
× |
17 |
for (let i = 0; i < arrayA.length; ++i) { |
× |
18 |
if (arrayB[i] !== arrayA[i]) {
|
× |
19 |
return false; |
× |
20 |
} |
× |
21 |
} |
× |
22 |
} |
× |
23 |
return true; |
× |
24 |
} |
× |
UNCOV
25
|
|
× |
UNCOV
26
|
/** Copy a value */
|
× |
UNCOV
27
|
export function arrayCopy<T>(a: T): T {
|
× |
28 |
const numberArray = isNumberArray(a);
|
× |
29 |
if (numberArray) {
|
× |
30 |
return numberArray.slice() as T;
|
× |
31 |
} |
× |
32 |
return a;
|
× |
33 |
} |
× |