-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaudit_script.ts
More file actions
41 lines (34 loc) · 1010 Bytes
/
Copy pathaudit_script.ts
File metadata and controls
41 lines (34 loc) · 1010 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { INITIAL_PHONE_MODELS, INITIAL_COMPATIBILITY_PAIRS } from './src/data/phoneDatabase';
const modelsCount = INITIAL_PHONE_MODELS.length;
let aliasCount = 0;
const modelNumbersCount = 0; // Retained for compatibility with historical audit output.
let duplicateDevices = 0;
let duplicateAliases = 0;
const seenIds = new Set();
const seenAliases = new Set();
INITIAL_PHONE_MODELS.forEach(m => {
if (seenIds.has(m.id)) duplicateDevices++;
seenIds.add(m.id);
if (m.aliases) {
aliasCount += m.aliases.length;
m.aliases.forEach(a => {
if (seenAliases.has(a)) duplicateAliases++;
seenAliases.add(a);
});
}
});
const compatibilityCount = INITIAL_COMPATIBILITY_PAIRS.length;
let evidenceCount = 0;
INITIAL_COMPATIBILITY_PAIRS.forEach(p => {
if (p.evidenceSources) {
evidenceCount += p.evidenceSources.length;
}
});
console.log(JSON.stringify({
modelsCount,
aliasCount,
duplicateDevices,
duplicateAliases,
compatibilityCount,
evidenceCount
}, null, 2));