MCPcopy Create free account
hub / github.com/getsentry/XcodeBuildMCP / normalizeNumber

Function normalizeNumber

src/snapshot-tests/json-normalize.ts:101–143  ·  view source on GitHub ↗
(path: string[], key: string | undefined, value: number)

Source from the content-addressed store, hash-verified

99}
100
101function normalizeNumber(path: string[], key: string | undefined, value: number): number {
102 if (
103 path.includes('capture') &&
104 path.includes('elements') &&
105 path.at(-2) === 'frame' &&
106 (key === 'x' || key === 'y' || key === 'width' || key === 'height')
107 ) {
108 return key === 'width' || key === 'height' ? 1 : 0;
109 }
110
111 switch (key) {
112 case 'toolCount':
113 if (path.includes('data')) return 99999;
114 return value;
115 case 'durationMs':
116 if (path.at(-2) === 'summary') return 1234;
117 if (path.includes('testCases')) return 0;
118 return value;
119 case 'processId':
120 case 'pid':
121 return 99999;
122 case 'uptimeSeconds':
123 return 3600;
124 case 'threadId':
125 return 1;
126 case 'capturedAtMs':
127 return 1_700_000_000_000;
128 case 'expiresAtMs':
129 return 1_700_000_060_000;
130 case 'snapshotAgeMs':
131 return 1234;
132 case 'seq':
133 if (path.includes('capture')) return 1;
134 return value;
135 case 'x':
136 case 'y':
137 case 'width':
138 case 'height':
139 return Math.round(value * 10) / 10;
140 default:
141 return value;
142 }
143}
144
145function isBuildSettingsEntry(value: Record<string, unknown>, path: string[]): boolean {
146 return (

Callers 1

normalizeValueFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected