MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / normalizeProfilesData

Function normalizeProfilesData

src/hooks/profilesStorage.ts:24–43  ·  view source on GitHub ↗
(value: unknown)

Source from the content-addressed store, hash-verified

22}
23
24export function normalizeProfilesData(value: unknown): ProfilesData {
25 if (!isRecord(value) || !isRecord(value.profiles)) {
26 return DEFAULT_PROFILES_DATA;
27 }
28
29 const profiles: ProfilesData['profiles'] = {};
30 for (const [name, config] of Object.entries(value.profiles)) {
31 if (name === DEFAULT_PROFILE_NAME) continue;
32
33 const validation = validateConfiguration(config);
34 if (validation.valid && validation.config !== null) {
35 profiles[name] = validation.config;
36 }
37 }
38
39 return {
40 profiles,
41 activeProfile: normalizeActiveProfile(value.activeProfile, profiles),
42 };
43}
44
45export function parseProfilesDataJson(stored: string | null): ProfilesData {
46 if (!stored) return DEFAULT_PROFILES_DATA;

Callers 2

parseProfilesDataJsonFunction · 0.85

Calls 4

validateConfigurationFunction · 0.90
normalizeActiveProfileFunction · 0.85
entriesMethod · 0.80
isRecordFunction · 0.70

Tested by

no test coverage detected