mirror of
https://github.com/therootcompany/golib.git
synced 2026-11-04 06:55:00 +00:00
Rewrote looksLikeMap from 6 layered heuristics down to 3 simple rules: 1. All numeric keys → map (certain) 2. Any key composed of words → struct (certain) 3. Everything else → map (safe default) The asymmetry is deliberate: a map misidentified as a struct explodes into hundreds of fields, while a struct misidentified as a map is compact and easy to fix. Word detection splits keys on _ and camelCase, checks segments for pronounceability (vowel/consonant rhythm). Short words (id, at, on) only count when paired with a strong 3+ char word. Also adds raw path type naming with Item suffix for collections (FriendsItem instead of Friend), real API test fixtures from PokeAPI and SWAPI, and UUID-based test data replacing synthetic abc123 keys.