MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / oneOf

Function oneOf

graph-ui/src/settings/view-preferences.ts:29–30  ·  view source on GitHub ↗
(candidate: unknown, choices: readonly T[], fallback: T)

Source from the content-addressed store, hash-verified

27function validated(value: unknown): Readonly<ViewPreferences> {
28 const row = typeof value === 'object' && value !== null ? value as Record<string, unknown> : {};
29 const oneOf = <T extends string | number>(candidate: unknown, choices: readonly T[], fallback: T): T =>
30 choices.includes(candidate as T) ? candidate as T : fallback;
31 return Object.freeze({
32 galaxyNodes: oneOf(row.galaxyNodes, GALAXY_NODE_LIMITS, DEFAULT_VIEW_PREFERENCES.galaxyNodes),
33 galaxyEdges: oneOf(row.galaxyEdges, GALAXY_EDGE_LIMITS, DEFAULT_VIEW_PREFERENCES.galaxyEdges),

Callers 1

validatedFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected