dotted CDDL name → cddl2ts PascalCase name (mirrors normalizeDottedName).
(name)
| 71 | |
| 72 | /** dotted CDDL name → cddl2ts PascalCase name (mirrors normalizeDottedName). */ |
| 73 | function tsName(name) { |
| 74 | return name |
| 75 | .split('.') |
| 76 | .map((part) => { |
| 77 | const titled = part.charAt(0).toUpperCase() + part.slice(1) |
| 78 | return titled.replace(/([A-Z]{2,})(?=[A-Z][a-z]|$)/g, (m) => m[0] + m.slice(1).toLowerCase()) |
| 79 | }) |
| 80 | .join('') |
| 81 | } |
| 82 | |
| 83 | const OPEN = '{([' |
| 84 | const CLOSE = '})]' |
no test coverage detected