(d: { on: string; arm: string; form: 'if' | 'switch' | 'ternary' | 'try'; not?: true })
| 303 | * and `else` for its default; a `try`'s arms keep their own words. |
| 304 | */ |
| 305 | export function armWords(d: { on: string; arm: string; form: 'if' | 'switch' | 'ternary' | 'try'; not?: true }): string { |
| 306 | if (d.form === 'if' || d.form === 'ternary') return d.not ? 'no' : 'yes'; |
| 307 | if (d.not) return 'else'; |
| 308 | let text = d.arm; |
| 309 | if (d.on && text.startsWith(d.on)) text = text.slice(d.on.length).trim().replace(/^===?\s*/, ''); |
| 310 | if (!text) return 'yes'; |
| 311 | return text.length > ARM_WORD_MAX ? `${text.slice(0, ARM_WORD_MAX - 1)}…` : text; |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * The one arm of one decision a connector is, when EVERY site behind it |
no outgoing calls
no test coverage detected