MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / normalizeProfile

Function normalizeProfile

apps/desktop/src/main/vault.ts:339–356  ·  view source on GitHub ↗
(candidate: unknown)

Source from the content-addressed store, hash-verified

337 ? Math.min(3, Math.max(0.5, Math.round(candidate.zoomFactor * 100) / 100))
338 : DEFAULT_CONFIG.zoomFactor
339 const normalizeProfile = (candidate: unknown): PersistedRemoteWorkspaceProfile | null => {
340 if (!candidate || typeof candidate !== 'object') return null
341 const value = candidate as Record<string, unknown>
342 const baseUrl = typeof value.baseUrl === 'string' ? value.baseUrl.trim() : ''
343 const name = typeof value.name === 'string' ? value.name.trim() : ''
344 if (!baseUrl || !name) return null
345 return {
346 id: typeof value.id === 'string' && value.id.trim() ? value.id : randomUUID(),
347 name,
348 baseUrl,
349 authToken: typeof value.authToken === 'string' ? value.authToken : null,
350 vaultPath: typeof value.vaultPath === 'string' && value.vaultPath.trim() ? value.vaultPath : null,
351 lastConnectedAt:
352 typeof value.lastConnectedAt === 'number' && Number.isFinite(value.lastConnectedAt)
353 ? value.lastConnectedAt
354 : null
355 }
356 }
357 const normalizeLocalVault = (candidate: unknown): PersistedLocalVault | null => {
358 if (!candidate || typeof candidate !== 'object') return null
359 const value = candidate as Record<string, unknown>

Callers 1

normalizePersistedConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected