github
296 of 440 branches covered (67.27%)
Branch coverage included in aggregate %.
67 of 368 new or added lines in 5 files covered. (18.21%)
8912 existing lines in 125 files now uncovered.13683 of 29689 relevant lines covered (46.09%)
0.57 hits per line
1 |
// luma.gl
|
1✔ |
2 |
// SPDX-License-Identifier: MIT
|
1✔ |
3 |
// Copyright (c) vis.gl contributors
|
1✔ |
4 |
|
1✔ |
5 |
const uidCounters: Record<string, number> = {}; |
|
6 |
|
1✔ |
7 |
/**
|
1✔ |
8 |
* Returns a UID. |
1✔ |
9 |
* @param id= - Identifier base name |
1✔ |
10 |
* @return uid |
1✔ |
11 |
**/ |
1✔ |
12 |
export function uid(id: string = 'id'): string { |
|
13 |
uidCounters[id] = uidCounters[id] || 1;
|
|
14 |
const count = uidCounters[id]++;
|
2✔ |
15 |
return `${id}-${count}`; |
2✔ |
16 |
} |
2✔ |
17 |
|
1✔ |
18 |
/** Returns true if given object is empty, false otherwise. */
|
1✔ |
19 |
export function isObjectEmpty(obj: object): boolean {
|
1✔ |
UNCOV
20
|
let isEmpty = true;
|
× |
UNCOV
21
|
// @ts-ignore key is unused
|
× |
UNCOV
22
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
× |
UNCOV
23
|
for (const key in obj) { |
× |
UNCOV
24
|
isEmpty = false;
|
× |
UNCOV
25
|
break;
|
× |
UNCOV
26
|
} |
× |
UNCOV
27
|
return isEmpty;
|
× |
UNCOV
28
|
} |
× |