- parse Excel input by header strings (pier, IP, bearing tables) - DMS azimuth parser (E03), input validation (E01, E02) - pure geometry: axis, bearings, stepped coping, column, footing, piles, blinding - warnings W01, W02, W05, W07, I01 - regression tests against spec.md section 12 (P1) Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
13 lines
461 B
TypeScript
13 lines
461 B
TypeScript
const DMS = /(\d+(?:\.\d+)?)°\s*(\d+)'\s*(\d+(?:\.\d+)?)"/;
|
|
|
|
/** Parses a degree-minute-second string such as ` 75°56'55.9"` into decimal degrees. Returns null when invalid. */
|
|
export function parseDms(text: string): number | null {
|
|
const m = DMS.exec(String(text));
|
|
if (!m) return null;
|
|
const deg = Number(m[1]);
|
|
const min = Number(m[2]);
|
|
const sec = Number(m[3]);
|
|
if (min >= 60 || sec >= 60) return null;
|
|
return deg + min / 60 + sec / 3600;
|
|
}
|