MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / parsePort

Function parsePort

apps/kimi-code/src/cli/sub/server/shared.ts:118–125  ·  view source on GitHub ↗
(raw: string | undefined, label: string, fallback: number)

Source from the content-addressed store, hash-verified

116}
117
118export function parsePort(raw: string | undefined, label: string, fallback: number): number {
119 if (raw === undefined) return fallback;
120 const n = Number.parseInt(raw, 10);
121 if (!Number.isFinite(n) || n < 0 || n > 65535) {
122 throw new Error(`error: invalid ${label} value: ${raw}`);
123 }
124 return n;
125}
126
127export function parseLogLevel(raw: string | undefined): ServerLogLevel {
128 if (raw === undefined) return DEFAULT_LOG_LEVEL;

Callers 3

addLifecycleCommandsFunction · 0.90
server.test.tsFile · 0.85
parseServerOptionsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected