MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / parseOptionalBoolean

Function parseOptionalBoolean

packages/codex-native-api/src/cli_options.ts:81–96  ·  view source on GitHub ↗
(value: unknown, fallback = false)

Source from the content-addressed store, hash-verified

79}
80
81export function parseOptionalBoolean(value: unknown, fallback = false): boolean {
82 if (typeof value === 'boolean') {
83 return value;
84 }
85 const normalized = String(value ?? '').trim().toLowerCase();
86 if (!normalized) {
87 return fallback;
88 }
89 if (['1', 'true', 'yes', 'y', 'on'].includes(normalized)) {
90 return true;
91 }
92 if (['0', 'false', 'no', 'n', 'off'].includes(normalized)) {
93 return false;
94 }
95 return fallback;
96}
97
98export function normalizeServeHost(options: Pick<ServeCliOptions, 'host' | 'publicBind'>): string | null {
99 return options.host ?? (options.publicBind ? '0.0.0.0' : null);

Callers 2

buildDaemonInstallPlanFunction · 0.70
buildServeArgsFromEnvFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected