Files
Pier_v1/src/core/dms.ts
T
ypshimandClaude Haiku 5.5 d963d8ed3c feat(core): parse P1 workbook and build T-type pier shape
- 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>
2026-10-21 17:26:16 +09:00

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;
}