Commit a153fc5
refactor(routeNormalization): extract helpers for improved readability
Extracted validation and transformation logic into self-documenting helper
functions:
- isValidRecordInput(): Type guard clearly stating 'is object and not array'
- shouldRejectAsArray(): Explains the design decision to reject arrays
- buildStringOnlyRecord(): Separates string-filtering logic with clear intent
Benefits:
- Removed inline conditional logic that required explanatory comments
- Each function name now conveys purpose without additional documentation
- Improved testability of individual concerns
- Simplified main normalizeRouteRecord() function body
All 9 routeNormalization tests pass with no regressions. Full test suite
validates: 2317 tests across 171 files. TypeScript type checking clean.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>1 parent 0565704 commit a153fc5
1 file changed
Lines changed: 16 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
37 | 49 | | |
38 | 50 | | |
39 | | - | |
| 51 | + | |
| 52 | + | |
40 | 53 | | |
41 | 54 | | |
42 | 55 | | |
| |||
0 commit comments